📜 ⬆️ ⬇️

Github cheat sheet

Hi, Habr! Once again, a very interesting repository caught my eye. This cheat sheet on the most secret and functional features of Git and GitHub appeared thanks to the speeches of Zack Holman, one of the articles of which I translated Git and GitHub Secrets to Aloha Ruby Conference 2012 and More Git and GitHub Secrets to WDCNZ 2013. It is worth saying that the project scored over 1000 olds in less than 12 hours. I will give a few examples:

Hub - Git Wrapper


Hub is a shell over Git, which reduces the time spent on unnecessary keystrokes when working with Git.
$ hub clone tiimgreen/toc > git clone https://github.com/tiimgreen/toc.git 

On the hub, you can make an alit git and everything will look even more convenient:
 # Remote $ git remote add rtomayko > git remote add rtomayko git://github.com/rtomayko/CURRENT_REPO.git #Fetch $ git fetch mislav > git remote add mislav git://github.com/mislav/REPO.git #Fork $ git fork [ repo forked on GitHub ] > git remote add -f YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git 



Previous branch


To go to the previous directory we use:
 $ cd - 

Similarly, you can switch between branches in Git:
 $ git checkout - # Switched to branch 'master' $ git checkout - # Switched to branch 'next' $ git checkout - # Switched to branch 'master' 

')

Closing Issues with Commitments


To do this, you must specify the Issue number in the commit and add the word single with fix / fixes / fixed or close / closes / closed:
 $ git commit -m "Fix cock up, fixes #12" 

image

Checking out Pull Requests


If you want to checkout for pull requests, you first need to pick it up:
 $ git fetch origin '+refs/pull/*/head:refs/pull/*' 

After that, it is necessary to checkout itself
 $ git checkout refs/pull/42 


View the history of a particular author’s commit


To do this, add the parameter ? Author = username to the URL:
 https://github.com/rails/rails/commits/master?author=dhh 


Stylized Git Log


 $ git log --all --graph --decorate --oneline --abbrev-commit 

image

Git query


Git Query allows you to find previous commits by message, where “query” is the search phrase:
 $ git show :/query 


And a whole lot of different secrets on github-cheet-sheet .

Thank you all for your attention.

Source: https://habr.com/ru/post/219219/


All Articles