Created
March 3, 2012 10:31
-
-
Save knzm/1965423 to your computer and use it in GitHub Desktop.
Git cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to get a remote branch on my local git repository: | |
$ git checkout origin/branch-1 | |
$ git checkout -b branch-1 | |
Or, is it a better way? | |
$ git checkout --track -b branch-1 origin/branch-1 | |
How to add an upstream repository and get it: | |
$ git remote add upstream <url> | |
$ git fetch upstream | |
How to merge upstream changes into the 'master' branch in my forked repo: | |
$ git checkout master | |
$ git merge upstream/master | |
$ git push | |
How to cancel recent changesets: | |
(local) | |
$ git reset --hard <revision> | |
(github) | |
$ git push -f origin <revision>:<branch> | |
Misc commands I use frequently: | |
$ git push -v -n | |
$ git add -u | |
$ git commit -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment