Cheat sheet
Git essentials cheat sheet
Daily commands and recovery moves without rewriting shared history.
Updated 2026-03-22
Daily
- status / diff
- Know what you are about to commit.
- add -p
- Stage hunks intentionally.
- commit
- Message explains why, not only what.
Branches
- switch -c
- Create and switch to a feature branch.
- rebase onto main
- Keep history linear locally; coordinate before rewriting shared branches.
- revert
- Safe undo on shared main — adds a compensating commit.
Never miss a drop
Get new guides on web development and AI, Prompt Lab tips, videos, downloads and exclusive deals — straight to your inbox. No spam, unsubscribe anytime.