Cheat Sheets

Git Cheat Sheet

Quick reference for the Git commands you reach for every day — from initializing repos to branch management, history inspection, and collaboration.

Init. Commit. Push. Repeat.

Create a Repository
git initgit clonegit clone (named)
Make a Change
git statusgit add (file)git add (all)git commitgit commit (all)git restoregit restore --stagedgit reset (file)git reset --hardgit diffgit diff --stagedgit rebase
Configuration
config user.nameconfig user.emailconfig color.uiconfig --edit
Working with Branches
git branchgit branch -avgit checkoutgit checkout -bgit branch -dgit mergegit tag
Observe Your Repository
git loggit log (range)git log --followgit diff (branches)git show
Synchronize
git fetchgit merge (remote)git merge --no-ffgit merge --ff-onlygit pushgit pullgit cherry-pick
Remote
git remote addgit remotegit remote -vgit remote rmgit remote set-url
Temporary Commits (Stash)
git stashgit stash listgit stash popgit stash drop
Tracking Path Changes
git rmgit mvgit log --stat -M
Rename Branch
branch -mpush renameddelete old remote
Log Tricks
log -S (search)log -p (file)log --graph
Branch Tricks
branch -vvcheckout -branch -rcheckout file
Rewriting History
commit --amend
Git Aliases
alias coalias bralias cialias st