git bisect does a binary search: for 200 commits it needs about 8 steps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # ====================================================================== # Q: A bug appeared sometime in the last 200 commits. How do you find which one # caused it? # # git bisect does a binary search: for 200 commits it needs about 8 steps. The # key is to have a test that reproduces the bug, so I write it first (and it # stays as a regression test). This is also one reason I want small, atomic # commits: bisect points you to a 20-line change, not a 3,000-line commit. # ====================================================================== git bisect start git bisect bad HEAD # it is broken now git bisect good v2.14.0 # it worked at this tag # automatic: the script returns 0 = good, 1 = bad, 125 = skip git bisect run pytest tests/test_pricing.py::test_volume_discount -x -q git bisect reset # return to the original HEAD |