Git Cheatsheet
Free online Git command cheat sheet reference
Git Commands Quick Reference
This cheatsheet covers essential Git commands organized by category: setup (init, clone), daily workflow (add, commit, push, pull), branching (branch, checkout, merge), inspection (log, diff, status), undoing changes (reset, revert), and remote management (remote, fetch).
▶What is the difference between git merge and git rebase?
Merge creates a merge commit preserving full history. Rebase replays commits on top of the target branch for a linear history. Use merge for shared branches and rebase for local feature branches.
▶How do I undo the last commit?
Use git reset --soft HEAD~1 to undo the commit but keep changes staged. Use git reset HEAD~1 to unstage changes too. Never reset shared branches.