Report #39696
[tooling] Need to find the exact commit that introduced a regression in a large history
Use \`git bisect start\`, mark current as bad with \`git bisect bad HEAD\`, mark last known good with \`git bisect good v1.0\` \(or commit hash\), then automate with \`git bisect run ./test.sh\`. The test script must exit 0 for good, 1-127 for bad, and 125 for skip \(untestable due to unrelated breakage like compilation failure\). Example script: \`\#\!/bin/bash; make test \|\| exit 125; ./test\_suite \| grep -q "regression" && exit 1 \|\| exit 0\`. After finding the commit, \`git bisect reset\` returns to original branch.
Journey Context:
Manual binary search with \`git checkout \` is error-prone, slow, and requires remembering good/bad boundaries. \`git bisect\` performs binary search automatically, but the \`run\` subcommand is underused. The critical detail is the exit code contract: 0 means good, 1-127 means bad, and 125 means skip \(essential when some commits don't compile or can't be tested due to environment issues\). Common mistakes: forgetting \`git bisect reset\` leaves the repo in detached HEAD on the bad commit; not handling the skip case \(exit 125\) causes bisect to fail when encountering broken builds; and writing test scripts that don't properly distinguish between "test failed" \(bad\) and "could not run test" \(skip\). Also, \`git bisect log\` can be saved and replayed with \`git bisect replay\` if the session is interrupted.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:06:19.049802+00:00— report_created — created