Git Bisect Step Planner

Work out what a git bisect over a range of commits will cost: the maximum number of good/bad tests, the commit to test first and the range left after each answer.

Range to search

The number of candidates, from the first commit after the good revision up to and including the bad one: git rev-list --count good..bad. Used only when the commit list below is empty.

Paste git log --reverse --oneline good..bad, one commit per line. Blank lines and a leading * from git log --graph are ignored. A commit list replaces the count whenever it holds at least one commit.

Worst-case test order, keeping the older half after each bad result
TestCommit to testLeft if goodLeft if bad

Start the session


After each test mark the checked-out commit with git bisect good or git bisect bad; git checks out the next candidate, or git bisect reset ends the session.

git bisect is a binary search over the commits between a known-good and a known-bad revision, so every test halves the candidates: an N-commit range is narrowed to a single commit in ceil(log2 N) tests, the smallest power of two that covers N. That is 7 tests for 100 commits, 10 for 1,000 and 20 for a million, where testing commit by commit would take up to N − 1. Each test splits the range into a lower and an upper half; a good answer moves the lower bound past the tested commit and a bad answer lowers the upper bound to it, so either way at most half the candidates remain. With an even number of candidates git may test either of the two middle commits; this plan takes the lower one and follows the older half, the branch that uses every test, and the “Left if good” and “Left if bad” columns show the candidates left after each answer. A commit skipped with git bisect skip costs an extra test because git has to pick another one, and merged history still bisects correctly although the count covers every commit in the range rather than a straight line. In the commands, <good-rev> is the last revision known to work — one commit before the oldest commit you listed — and the session ends with git bisect reset or runs unattended with git bisect run <cmd>, which marks a failing command bad and skips the commit on exit code 125. Everything is worked out in your browser; nothing is sent or stored.