Last active
June 21, 2016 17:46
-
-
Save scott-joe/3a6eae93f6fd2a19e53c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Git commands I always forget | |
- Create and checkout a new branch | |
- `git checkout -b branchName` | |
- Checkout a remote branch | |
- `git checkout -b localBranchName origin/remoteBranchName` | |
- Push local branch to remote | |
- `git push -u origin branchName` | |
- Delete remote branch | |
- `git push origin --delete branchName` | |
- `git push origin :branchName` | |
- Prune local branches | |
- `git remote prune origin` | |
- Various resets | |
- `git reset --soft HEAD^` | |
- `git reset --hard HEAD` | |
- `git reset --hard origin/master` | |
- Push non-master branch to Heroku | |
- `git push heroku branchName:master` | |
- `git push heroku +HEAD:master` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
checking out a remote branch - if you want
localBranchName
to be the same asremoteBranchName
you can just rungit checkout remoteBranchName
and it will create the local branch & set it to track the remote