A refactor may break a behavior without making the failing change obvious. Suppose a response formatter now drops a required field. Write a check that passes when the field is present and fails when it is missing. That gives each commit a result you can test.
Git’s bisect manual describes a search between a known bad commit and a known good commit. Git checks out a commit between them. You test it, mark it good or bad, and repeat until Git identifies the first bad commit.
Establish the range
Run the check on the revision where the failure appears. Then run it on an earlier revision where the behavior still works. Confirm both results before starting the search. A commit that merely predates the refactor is not a useful good endpoint unless it passes the same check.
Start the search with the two commit IDs:
git bisect start <bad-commit> <good-commit>
Git checks out a revision within that range. Run the check there. If it passes, enter git bisect good. If it fails, enter git bisect bad. Git selects the next revision after each result. Keep using the same check and the same pass condition throughout the search.
Handle revisions you cannot judge
An intermediate revision may fail to build for a reason unrelated to the behavior you are tracking. Use git bisect skip when you cannot give it a sound good or bad result. The manual warns that skipped commits near the change can prevent Git from identifying one exact first bad commit. Record why you skipped a revision so the remaining uncertainty is visible.
If the check is a script, git bisect run <script> can run it at each selected revision. The script must return 0 for good, a failure code for bad, or 125 when that revision cannot be tested. Keep the script outside the repository, as the manual recommends, so changing revisions does not change the check itself.
What to do
- Make one repeatable check for the broken behavior and confirm a good and bad endpoint.
- Start
git bisectand classify each selected revision, or run a script with clear exit codes. - Inspect the reported commit and verify the failure around it. Save the search record with
git bisect logif you need it, then rungit bisect resetto return to your original revision.

The Campfire
No commentsNobody has pulled up a log by this one yet. Be the first to say what you make of it.
Held for the desk. It appears after a look.