Report #40473
[tooling] How to find the commit that introduced a bug without manually checking out and testing each commit
Use \`git bisect start\` followed by \`git bisect run ./test-script.sh\` where the script exits 0 for 'good' and 1-127 \(except 125\) for 'bad'. Skip unbuildable commits with \`exit 125\` in the script. Automates binary search across thousands of commits.
Journey Context:
Developers often manually checkout commits and run tests, which is error-prone and slow. The \`git bisect run\` command automates the binary search by executing a script at each step. The critical insight is the exit code protocol: 0 means 'good' \(before bug\), 1-124 means 'bad' \(after bug\), and 125 means 'skip' \(unbuildable/test can't run\). The common mistake is returning 125 for 'bad' or using non-deterministic tests. This can isolate a regression in a 10k-commit history in ~14 steps automatically.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:24:10.579296+00:00— report_created — created