Git Advanced Workflows & Recovery Cheat Sheet
4-page Git cheat sheet: reflog recovery, fixup/autosquash, rebase --onto, bisect run, conflict tools, and a baseline config. Git 2.38+.
Pay what you want · instant download · 2–4 dense pages
Not sure yet? Get the 1-page Quick Reference free ($0, instant download).
What's in the full sheet
- Quick Reference
- Core Patterns
- Production Commands
- Best Practices
- Common Pitfalls
- Debugging Checklist

Free preview
Rewrite history safely, run parallel workflows, and recover almost any lost work. Targets Git 2.45+; every feature used here has been available since Git 2.38 or earlier.
Quick Reference
| Task | Command |
|---|---|
| Show every HEAD move | git reflog |
| Undo last reset/rebase/merge | git reset --hard ORIG_HEAD |
| Restore a file from any commit | git restore --source=<sha> -- path |
| Unstage, keep edits | git restore --staged path |
| Fold staged changes into an old commit | git commit --fixup=<sha> then git rebase -i --autosquash <base> |
| Move a branch to a new base | git rebase --onto <newbase> <oldbase> <branch> |
| Compare two versions of a series | git range-diff <base> <old-tip> <new-tip> |
| Find the regression commit | git bisect start <bad> <good> then git bisect run <cmd> |
| Work on a second branch in parallel | git worktree add ../hotfix -b hotfix origin/main |
| Safe force-push | git push --force-with-lease --force-if-includes |
| Undo a pushed merge | git revert -m 1 <merge-sha> |
| Copy a commit, recording its origin | git cherry-pick -x <sha> |
| Find when a string appeared or vanished | git log -S'needle' --oneline |
| Show the history of a function | git log -L :funcName:path/file.c |
| Find lost commits and blobs | git fsck --lost-found |
The rest of the sheet: Core Patterns, Production Commands, Best Practices, Common Pitfalls, Debugging Checklist.
Pay what you want · instant download · 2–4 dense pages
Not sure yet? Get the 1-page Quick Reference free ($0, instant download).
More cheat sheets
kubectl Troubleshooting & Daily Commands Cheat SheetA 4-page kubectl PDF for Kubernetes v1.31+: pod triage, debug containers, rollouts, DNS checks, pitfalls, and a 17-step debug checklist.
ADB Command Cheat Sheet: Android & Google TV Debugging, Debloating, and Device ControlA 4-page ADB reference for Android phones and Google TV: Wi-Fi pairing, app installs, reversible debloating, logcat, remote control, and fixes.