git bisect run quick reference¶
One-line commands and exit codes for automated regression hunting.
Basic run¶
One-liner sequence¶
With worktree isolation¶
git worktree add ../bisect-runner HEAD
cd ../bisect-runner
git bisect start && git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test.sh
cd - && git worktree remove ../bisect-runner
With first-parent merge handling¶
git bisect start --first-parent && git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test.sh
Path-scoped bisect¶
git bisect start -- services/payments
git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test-payments.sh
Exit code contract¶
| Code | Meaning | Action |
|---|---|---|
| 0 | Good (passed) | Moves to later range |
| 1-124 | Bad (failed) | Moves to earlier range |
| 125 | Skip | Tries next candidate |
| 126-127 | Script error | Aborts |
Test script template¶
#!/bin/bash
set -euo pipefail
npm ci || exit 125
npm run build || exit 125
npm run test:regression && exit 0 || exit 1
Replay a saved session¶
Abort¶
CI workflow snippet (Forgejo)¶
- name: Automated bisect
run: |
git fetch origin
git bisect start
git bisect bad origin/main
git bisect good ${{ inputs.good_tag }}
git bisect run ci/bisect-ci.sh
Aliases¶
See also¶
docs/devops-workflows/git-bisect-run.md— full advanced guidedocs/devops-workflows/git-bisect-ci-triage.md— basic bisect setupscripts/bisect-run-manage.sh— automation script