Git Bisect to Find a Bug
Binary search through commits to find when a bug was introduced
CLAUDE.md
When using git bisect to find a regression:
- Start bisect:
git bisect start. - Mark the current broken state:
git bisect bad. - Mark a known good commit (last release, or a commit where the bug didn’t exist):
git bisect good <hash>. - At each step, test whether the bug exists. Mark the commit as
git bisect goodorgit bisect bad. - Continue until bisect identifies the first bad commit.
- Examine the identified commit to understand what introduced the bug.
- End the bisect:
git bisect reset.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.