Git Commands Cheat Sheet
Searchable reference for Git commands — setup, branching, history, undoing changes, remotes and stash. Click any command to copy it.
How to use this Git cheat sheet
Search or filter by category to find the Git command you need, then click the copy icon to grab it — no more re-typing the same flags every time.
Most-used Git commands
In day-to-day work, the commands you'll reach for most are: git status, git add, git commit, git push, git pull, git branch and git log --oneline.
Frequently Asked Questions
What is the difference between git merge and git rebase?
git merge creates a new merge commit that joins two branch histories, preserving how things actually happened. git rebase replays your commits on top of another branch, producing a linear history — but it rewrites commit hashes, so avoid rebasing commits that are already pushed and shared.
How do I undo the last commit without losing my changes?
Run git reset --soft HEAD~1. This moves the branch pointer back one commit but keeps your changes staged, ready to re-commit. Use --mixed to unstage them too, or --hard only if you want to discard the changes entirely.