Git Bisect
ELI5 - The Vibe Check
Git bisect is a binary search for bugs. Instead of scrolling through 200 commits guessing which one broke production, you tell git one known-good commit and one known-bad commit, and it checks out the exact midpoint for you to test. You say good or bad, it halves the search space again, and it usually finds the culprit in about eight tries instead of two hundred, as long as the commits in between actually build and run.
Real Talk
git bisect performs a binary search across a commit range using a boolean good or bad classification supplied by the developer, or by an automated test script via git bisect run, checking out the midpoint commit at each step until it isolates the exact commit that introduced a regression. Its usefulness depends entirely on having a bisectable history, meaning every intermediate commit is in a buildable, testable state rather than a broken work in progress snapshot.
Show Me The Code
$ git bisect start
$ git bisect bad HEAD
$ git bisect good v1.4.0
Bisecting: 87 revisions left to test after this (roughly 7 steps)
$ git bisect run npm test
When You'll Hear This
"Just bisect it, don't guess which commit broke the build." / "Bisect found it in six steps, the culprit was the caching change."
Related Terms
CI (Continuous Integration)
CI is like a robot assistant that instantly checks your homework every time you hand it in.
Commit Hygiene
Commit hygiene is treating your git history like something other people, including future you, will actually have to read, not just a diary of every save p...
Reflog
Git's reflog is the secret undo history that survives even after you think you've deleted something forever.
Regression
Regression is like classification but instead of sorting things into categories, you're predicting a number. What will this house sell for?