DEV Community

Discussion on: Finding the culprit commit

Collapse
 
nas5w profile image
Nick Scialli (he/him) • Edited

There's actually native git functionality to do this: git bisect

This command uses a binary search algorithm to find which commit in your project’s history introduced a bug. You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced. Then git bisect picks a commit between those two endpoints and asks you whether the selected commit is "good" or "bad". It continues narrowing down the range until it finds the exact commit that introduced the change.

Collapse
 
nishantwrp profile image
Nishant Mittal

OMG! Didn't know git had this functionality. Thanks for sharing :)

Collapse
 
nas5w profile image
Nick Scialli (he/him)

You can be reassured that your instinct to do binary search was so spot-on that git already had a function for it!