The Real Problem
sh check-times.sh
# BAD: recipe-33.md (Cook time: 'quick')
Something, somewhere in the last 50 real commits, left a recipe file with a genuinely non-numeric cook time. The current failure tells you THAT it's broken — not which of the 50 commits did it.
A Real Binary Search, Not Fifty Diffs
git bisect start HEAD HEAD~50
# git checks out a real commit roughly halfway between the two
sh check-times.sh # test THIS commit
git bisect good # or: git bisect bad
Each real answer — good or bad — halves the remaining search space. git checks out the new midpoint automatically and waits for the next real answer.
Landing on the Real Answer
git bisect bad
# a491a83 is the first bad commit
git bisect reset
Once only one commit remains, git names it directly. git bisect reset returns you to your real branch, exactly where you started — bisect never changes your branch's actual history, only what's checked out while you search.
check-times.sh is a real, small script that validates every recipe file states a genuine, numeric cook time. It has been passing for a long time. Right now, on the current real HEAD, it genuinely fails — and fifty ordinary-looking "add a recipe" commits have landed since the last time anyone checked.
Reading fifty real diffs by hand would work eventually. git bisect does the same job with a real binary search instead: pick a commit roughly halfway between the last known-good point and now, test it, and the answer to that ONE test cuts the real search space in half every single time. Fifty commits takes six real rounds, not fifty.
git bisect
A real binary search over a range of commits, driven by your own real good/bad judgment at each step. Confirmed directly in this lab: 50 real commits took exactly 6 real rounds to narrow down to one.
git bisect reset
Returns you to the real branch and commit you started from before the bisect began. Confirmed directly in this lab: bisect leaves your actual branch pointer untouched the entire time — only the checked-out commit moves while you search.
Takeaways
- git bisect start <bad> <good> begins a real binary search between two real, known commits
- Each real git bisect good/bad answer halves the remaining search space
- A range of 50 commits takes at most 6 real rounds — log2(50) rounded up, not 50 individual checks
- git bisect reset returns you to your real branch exactly where you started — the search never rewrites history