Practical Tips for Advanced Git Bisect
Practical Notes on Advanced Git Bisect
This is an adaptation from my Twitter thread:
Git Bisect Thread
Recap of Bisect
I assume you’ve used or heard of git bisect. If you’ve neither heard off nor used git bisect before, then I encourage you to give it a try. Franziska Hinkelmann provides a good intro and a test repo to find a bug with git bisect.
Recap:
git bisect start BAD GOOD- <RUN TEST>
- label result with
git bisect goodor... bad(orskip) - Goto 2 until git bisect tells you it’s done.
This then does a binary search1 through all commits between the GOOD and the BAD commit. After each step you have to label the current commit with good, bad or skip. Because binary search halfs the search range in every step, the number of commits to check is approximately log2(N), where N is the number of commits between GOOD and BAD. This means you can check 1000 commits in just 10 steps!