Last active
September 26, 2015 21:37
-
-
Save philly-mac/1162650 to your computer and use it in GitHub Desktop.
Because I always forget the syntax of some git commands
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
# <remote> is usually origin | |
# Check out remote branch | |
git checkout -b <local-branch-name> <remote>/<remote-branch-name> | |
# Delete local branch | |
git branch -D <local-branch-name> | |
# Delete remote branch | |
git push <remote> :<remote-branch> | |
# Create new local branch | |
git branch <local-branch-name> | |
# Push to a new remote branch | |
git push <remote> <remote-branch-name> | |
# Make local branch track remote branch | |
git branch --set-upstream <local-branch-name> <remote>/<remote-branch-name> | |
# Check out file from another branch | |
git checkout <branch-name> -- <file-path> | |
# Push a new remote branch and track it | |
git push -u <remote> <branch-name> | |
# Delete git tag | |
git tag -d <tag-name> | |
git push <remote> :refs/tags/<tag-name> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment