Appearance
git bisect run quick reference
One-line commands and exit codes for automated regression hunting.
Basic run
bash
git bisect start
git bisect bad HEAD
git bisect good v2.3.0
git bisect run ./test.shOne-liner sequence
bash
git bisect start && git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test.shWith worktree isolation
bash
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-runnerWith first-parent merge handling
bash
git bisect start --first-parent && git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test.shPath-scoped bisect
bash
git bisect start -- services/payments
git bisect bad HEAD && git bisect good v2.3.0 && git bisect run ./test-payments.shExit 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
bash
#!/bin/bash
set -euo pipefail
npm ci || exit 125
npm run build || exit 125
npm run test:regression && exit 0 || exit 1Replay a saved session
bash
git bisect log > /tmp/bisect-session.log
git bisect replay /tmp/bisect-session.logAbort
bash
git bisect resetCI workflow snippet (Forgejo)
yaml
- 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.shAliases
ini
[alias]
brun = bisect run
blog = bisect log
bplay = bisect replaySee 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