🔍 Binary Search for Bugs
Bug appeared somewhere in last 100 commits. Which one? Bisect finds it in 7 tries (logâ‚‚ 100).
git bisect start git bisect bad # Current commit has bug git bisect good abc1234 # This old commit was fine # Git checks out middle commit # You test: does bug exist? git bisect bad # or git bisect good # Repeat 5-7 times # Git finds exact commit that introduced bug
Automate: git bisect run npm test – runs tests automatically, finds bug without manual testing.
Result: Find bug-introducing commit in minutes instead of hours of manual checking.
