###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
###Set a Heroku remote to an existing repo
heroku git:remote -a [heroku app name]
###fix a local commit git commit -m "Something terribly misguided" git reset --soft HEAD~ << edit files as necessary >> git add [yourFiles] git commit -C ORIG_HEAD
###Rename branch locally and remote git branch -m old_branch [newBranchName] git push origin :[oldBranchName] git push --set-upstream origin [newBranchName]
###Push both commits and annotated tags
git push --follow-tags
###Checkout latest tag
git checkout $(git describe --tags git rev-list --tags --max-count=1
)
###Remove a remote tag git tag -d [tagName] git push origin :refs/tags/[tagName]
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