My git Cheat Sheet

This is my git cheat sheet. There are many like it, but this one is mine.

Checkout and track a remote branch

git fetch
git checkout branch_name

Show branches that contain a particular commit

git branch --contains SHA1

Show the last 10 commits - one line for each

git log -10 --pretty=oneline

Push a new local branch to remote and track it

git checkout -b branch_name
git push -u origin branch_name

Checkout and track a remote branch

git fetch
git checkout branch_name

List branches that have and have not been merged into master

git branch --merged master
git branch --no-merged master

Delete local and remote branch

git branch -d branch_name
git push origin --delete branch_name
Author image
About Brice Wilson
Software Developer and Trainer