GtGit · Lesson 7 of 8
Reading History Like a Detective
Who wrote this line? When did this bug appear? What changed last week? Git answers all of these — history isn't just backup, it's documentation.
git bisect deserves special mention: it binary-searches history for the commit that introduced a bug. Mark one good commit and one bad commit, and git checks out the midpoint; you test and say good or bad; repeat. A thousand commits is only ~10 tests.
◆ Note
This is why small, working commits matter: bisect can only pinpoint a bug to a commit. If that commit is a 2,000-line 'various fixes', you've found the haystack, not the needle.
This is why small, working commits matter: bisect can only pinpoint a bug to a commit. If that commit is a 2,000-line 'various fixes', you've found the haystack, not the needle.