- Realize you have a defect in master.
- Find a changeset in the past where you know the defect didn't exist (make a note of it)
- checkout most recent changeset (i.e. master)
- git bisect start
- git bisect good [changeset]
- git bisect bad master
- This will set the checkout changeset to a bad state and checkout
- Test your code
- If you find the bug
- git bisect bad
- If the bug doesn't exist
- git bisect good
- If you get to a changeset that prevents you from testing
- git bisect skip
- When you get to the end, you should see something like:
00000e22334373dcddad1ggw48e3da8bfdce243b is the first bad commit
commit 00000e22334373dcddad1ggw48e3da8bfdce243b
To exit from git bisect: git bisect reset
To go to that bad commit: git checkout 00000e22334373dcddad1ggw48e3da8bfdce243b