`git bisect` points to a commit that is obviously unrelated, or the result flips between runs.
IntermediateTroubleshootingLost Work, HEAD and History Problems
Answer
Likely causes → Good and bad were swapped, the test is flaky, the build fails on some commits (not the bug), or merge commits confuse the search.
Diagnose →
git bisect log
git bisect visualize --oneline
Fix → git bisect reset, then restart with a deterministic script and use exit code 125 for untestable commits: git bisect run ./check.sh. For "fix" hunts use git bisect start --term-old=broken --term-new=fixed. Try --first-parent on merge-heavy history.
Prevent → Keep every commit buildable and write the test before bisecting.
More on Lost Work, HEAD and History Problems
`fatal: Unable to create '/repo/.git/index.lock': File exists.`BeginnerYou added a file to `.gitignore`, but `git status` still shows it as modified.Beginner`fatal: your current branch 'main' does not have any commits yet`Beginner`Author identity unknown *** Please tell me who you are.` and `fatal: unable to auto-detect email address`Beginner`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate