Essential Git Commands by Category
A good Git cheat sheet gives you the command you need in under 10 seconds. Ours is organized by workflow stage: starting work (clone, init, checkout), making changes (add, commit, amend), syncing with remotes (fetch, pull, push), branching (branch, merge, rebase), and undoing mistakes (reset, revert, restore).
Each entry shows the minimal syntax to accomplish the task, with flags you'll actually use. We skip flags you'll never need and focus on the patterns that cover 95% of daily Git work. If you're constantly Googling the same commands, this cheat sheet makes those lookups instant.
Beyond basic commands, the cheat sheet covers workflow patterns: feature branching, interactive rebase for clean history, fixing merge conflicts, cherry-picking hotfixes, and recovering from common mistakes (detached HEAD, accidental branch deletion, force-push recovery).
Tips
- Set up a global
~/.gitconfigwith aliases:co = checkout,br = branch,st = statussaves keystrokes. git diff --stagedshows what's already added (staged) but not yet committed — useful beforegit commit.git branch -vvshows local branches with their upstream tracking branch and ahead/behind status.git blame -w -L 10,20 file.jsshows who last changed lines 10-20, ignoring whitespace-only changes (-w).