Git bisect and reflog: find the bad commit, recover lost work
11 steps · about 2 h 57 min · Intermediate
- LearnGitBranching: an interactive git visualization and tutorial (interactive, Peter Cottle / GitHub, 45 min)
Seeing commits as a graph of pointers makes both bisect's midpoints and reflog's recovery easier to understand.
- A beginner's guide to GIT BISECT - The process of elimination (article, Metal Toad, 10 min)
It explains in plain English why bisect is fast: it is binary search over your history.
- Use Git Bisect to Find the Commit That Introduced a Bug (article, Mokkapps, 10 min)
A step-by-step manual bisect session with start, good, bad and reset.
- Find the Git commit that introduced a bug - 30 seconds of code (article, 30 seconds of code, 5 min)
A compact cheat sheet comparing manual bisecting with git bisect run.
- Git Bisect Example: How to Find the Exact Buggy Commit (article, Icinga, 10 min)
A worked example that ends with the first bad commit, plus the exit-code 125 skip trick.
- Git Bisect: Finding the Commit That Broke Your Code - TeachMeIDEA (article, TeachMeIDEA, 20 min)
It covers automating bisect with test scripts and handling merge commits and broken builds.
- Git - git-bisect Documentation (doc, git-scm.com, 25 min)
The official reference for the full details: terms, skip, run, and merge handling.
- Git Reflog Explained: Recover Deleted Commits & Lost Work (article, DEV Community, 10 min)
It starts the reflog half with the classic case: recovering from an accidental reset --hard.
- Recovering Lost Commits with Git Reflog (article, OpenReplay, 12 min)
It sets out what reflog can and can't recover, how long entries last, and when to use git fsck.
- Lose a Commit, Get it Back (tutorial, Educative, 15 min)
A hands-on repo setup where you lose a commit and get it back yourself.
- Git - git-reflog Documentation (doc, git-scm.com, 15 min)
The official reference for HEAD@{n} syntax, expiry and the reflog subcommands.