Last active
October 14, 2015 01:17
-
-
Save euler0/4285394 to your computer and use it in GitHub Desktop.
Git Cheat Sheet
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
# Delete a remote branch (or a tag) | |
$ git push origin --delete branch | |
# Or a syntactic sugar | |
$ git push origin :branch | |
# Delete a remote-tracking branch | |
$ git branch -r -d origin/branch | |
# Squash the last 4 commits | |
$ git rebase -i HEAD~4 | |
# Undo a merge | |
$ git reset --hard HEAD^ | |
# git reset --hard HEAD~4 | |
# Track a remote branch | |
$ git branch --set-upstream foo origin/foo | |
# As of Git 1.8.0 | |
$ git branch -u origin/foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment