patternModerate
Git bisect for finding the commit that introduced a bug
Viewed 0 times
git bisectbinary searchregressionbisect runfind bad commit
Problem
A bug exists now but worked before. Need to find which commit introduced the regression across hundreds of commits.
Solution
Use git bisect: git bisect start, git bisect bad, git bisect good <known-good>. Git checks out middle commit — test and mark. Automate: git bisect run ./test-script.sh. For 1000 commits, finds bug in ~10 steps. After: git bisect reset.
Why
Binary search halves the space each step. For N commits, bisect needs log2(N) checks. Manual checking of 1000 commits takes hours; bisect takes 10 checks.
Revisions (0)
No revisions yet.