You need to start by 'git bisect start' — bisect session not initialized or in bad state
ID: git/bisect-bad-revision
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Git bisect errors occur when the bisect session isn't properly initialized, bad/good commits are specified incorrectly, or the session state becomes corrupted. The three-step flow (start -> mark bad -> mark good -> test) must be followed precisely, and forgetting to reset after completion leaves the repo in a detached HEAD state.
genericWorkarounds
-
95% success Follow the correct bisect workflow: start, bad, good, test, repeat, reset
1) 'git bisect start' 2) 'git bisect bad' (current commit is bad) 3) 'git bisect good <known-good-commit>' 4) Test the code at the checkout point 5) 'git bisect good' or 'git bisect bad' based on test 6) Repeat until git identifies the first bad commit 7) 'git bisect reset' to return to your branch.
Sources: https://git-scm.com/docs/git-bisect
-
88% success Use git bisect run for automated bisection
Run 'git bisect run <test-script>' where the script exits 0 for good commits and non-zero for bad. Example: 'git bisect run python -m pytest tests/test_feature.py'. Git automatically checks out commits and runs your test until the first bad commit is found.
Sources: https://git-scm.com/docs/git-bisect
-
82% success Use git bisect skip for untestable commits
When a checkout can't be tested (build broken, unrelated failure), use 'git bisect skip' instead of good/bad. Git will try nearby commits. You can also skip ranges: 'git bisect skip <start>..<end>'.
Sources: https://git-scm.com/docs/git-bisect
Dead Ends
Common approaches that don't work:
-
Running git bisect good/bad without first running git bisect start
95% fail
Git bisect requires an active session. Running 'git bisect good' or 'git bisect bad' without 'git bisect start' first results in 'You need to start by git bisect start'. The session must be explicitly initialized.
-
Forgetting to run git bisect reset after finding the culprit commit
70% fail
After bisect completes, your repo is left in a detached HEAD state at the culprit commit. If you start making changes or committing without running 'git bisect reset' first, you'll be working on a detached HEAD and may lose work. Always run 'git bisect reset' to return to your original branch.
-
Marking a commit as both good and bad, or swapping good/bad labels
85% fail
If you accidentally mark a good commit as bad (or vice versa), bisect will converge on the wrong commit. Git cannot detect this mistake. The result will be a false positive. If the bisect result seems wrong, 'git bisect log' shows your markings for review.