Git Branch Cheat Sheet

Because I can never remember.™

CommandDescription
git checkout -b develop
Create a new branch develop and switch to it; can be done after local modifications.
git push -u origin develop
Push the branch (after committing).
git branch
See existing local branches that have been checked out or created.
git remote show origin
See what remote branches are being tracked even if they're not checked out locally.
git fetch --all
git checkout develop
Fetch and check out a remote branch develop if it's not already tracked.
git checkout develop
Check out an existing tracked branch named develop.
git checkout master
git merge develop
Merge develop into master.
# local
git branch -D branchname

remote

git push origin --delete branchname

Delete a branch.