git bisect: some good revs are not ancestors of the bad rev Git Origin: Build & delivery OSI layer 7 · Application Last updated 25 Nov 2026

Some good revs are not ancestors of the bad rev. git bisect cannot work properly in this case.

The commit you marked good isn't in the history of the bad one.

Exact message you may see Some good revs are not ancestors of the bad revgit bisect cannot work properly in this caseSome good revs are not ancestors of the bad rev. git bisect cannot work properly in this case. Maybe you mistook good and bad revs?
Seen on: Git

Meaning

Bisect needs the good commit to be an ancestor. Pick a good commit on the same line of history, or merge-base the two first.

Common causes

  • Good commit on another branch
  • Wrong bad/good order
  • Rewritten history

⚡ Quick fix

  1. Use git merge-base good bad
  2. Swap good/bad if mislabelled
  3. git bisect reset and restart

Detailed fix by platform

Git

  1. bash
    git bisect reset
    git bisect start BAD GOOD
    git merge-base GOOD BAD

How to diagnose

  1. Ancestry — good in bad history?
  2. Order — right?
  3. History — rewritten?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

actions/checkout: shallow clone, git history missing — fatal: couldn't find remote ref refs/heads/x (fetch-depth: 1) (Git)actions/checkout: sha…error: Repository lacks these prerequisite commits — error: Repository lacks these prerequisite commits: a1b2c3d... (Git)error: Repository lac…fatal: --unshallow on a complete repository does not make sense — fatal: --unshallow on a complete repository does not make sense (Git)fatal: --unshallow on…fatal: could not open .git-blame-ignore-revs — fatal: invalid object name 'abc...' in ignore-revs-file (Git)fatal: could not open…migrate: override changes in your working copy? — Uncommitted changes. git lfs migrate: Cannot migrate with a dirty working tree (Git)migrate: override cha…not a valid object name — fatal: Not a valid object name: 'main'. (Git)not a valid object na…Rebase replays too many commits / unrelated histories — fatal: refusing to merge unrelated histories (Git)Rebase replays too ma…Remove a committed secret from Git history — (task) git filter-repo --path .env --invert-paths (Git)Remove a committed se…git bisec…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.