Report #13934
[tooling] How do I automate git bisect to find the exact commit that broke the build without manually checking out each commit
Use \`git bisect start\`, mark boundaries with \`git bisect good \` and \`git bisect bad \`, then run \`git bisect run ./test-script.sh\` where the script exits 0 \(good\), 1-127 \(bad\), or 125 \(skip/untestable\). The bisect will binary search automatically and output the first bad commit.
Journey Context:
Manual bisecting is tedious and humans make mistakes marking commits. \`git bisect run\` automates the binary search using a test script. The critical detail is the exit code contract: 0 means 'good', 1-127 means 'bad', and 125 specifically means 'skip' \(e.g., commit doesn't compile\). This allows bisecting even through broken commits. The script should be idempotent and fast. For merge-heavy histories, use \`git bisect start --first-parent\` to only follow the main branch, avoiding testing individual feature branch commits that were squashed. If the test is flaky, bisect can fail; ensure the script is reliable. When finished, \`git bisect reset\` cleans up.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:14:17.982356+00:00— report_created — created