Git is the version control system that every developer uses daily — and yet most developers know only 10% of the commands they actually need. This cheat sheet covers the complete set of commands you should actually know.
The Essential Daily Commands
git status # Full status
git add . # Stage all changes
git commit -m "message" # Commit with message
git push # Upload local commits
git pull # Fetch + merge
Branching and Merging
git branch -a # List all branches
git checkout -b new-branch # Create and switch
git merge feature # Merge into current branch
git rebase main # Rebase onto main
Undoing Changes
git checkout -- file.txt # Discard working directory changes
git reset HEAD file.txt # Unstage file
git revert HEAD # Create new commit that undoes last
When Stuck: Your Safety Net
git stash # Temporarily set aside work
git stash pop # Restore stashed work
git reflog # Show every HEAD movement
git checkout abc123 # Go back to any previous state
The Bottom Line
Master these commands and you'll handle 95% of real-world Git situations:
- Daily: status, add, commit, push, pull, branch, switch
- When stuck: reflog, reset, stash, revert
- When debugging: log, diff, blame, bisect
Git is powerful. These commands give you that power.
Free Developer Tools
If you found this article helpful, check out DevToolkit — 40+ free browser-based developer tools with no signup required.
Popular tools: JSON Formatter · Regex Tester · JWT Decoder · Base64 Encoder
🛒 Get the DevToolkit Starter Kit on Gumroad — source code, deployment guide, and customization templates.
Top comments (0)