Cheat Sheet
The commands you keep forgetting, with a one-line description and a real example you can copy - 629 across 38 tools. Pick a tool in the sidebar, or search across all of them.
Showing Git (Advanced). Choose another tool in the sidebar, or search all 629 commands.
Git (Advanced)
The Git commands you reach for when things get serious.
| Command | What it does | Example |
|---|---|---|
git rebase -i | Reorder, squash, or edit recent commits. | git rebase -i HEAD~3 |
git commit --amend | Fix up the most recent commit. | git commit --amend |
git cherry-pick | Apply a single commit onto your branch. | git cherry-pick 1a2b3c4 |
git bisect | Binary-search history for the bad commit. | git bisect start && git bisect bad && git bisect good v1.0 |
git reflog | See every move HEAD made - recover lost work. | git reflog |
git reset (to reflog) | Jump back to a remembered state. | git reset --hard HEAD@{2} |
git worktree | Check out a second branch in a sibling folder. | git worktree add ../hotfix main |
git stash push -m | Stash with a label. | git stash push -m "wip login" |
git revert -m | Revert a merge commit. | git revert -m 1 1a2b3c4 |
git clean -fd | Delete untracked files and folders. | git clean -fd |
git log --grep | Find commits by message. | git log --grep="login bug" |
git blame | See who last changed each line. | git blame src/app.js |
git diff --staged | Review what you are about to commit. | git diff --staged |