Find a Regression With git bisect

Binary-search history by marking commits good or bad.

macOSdiffgitcliLow risk
Run git bisect start, then mark the current commit bad and a known-good tag with git bisect good.

01Command

Command
$ git bisect start && git bisect bad && git bisect good v1.0

02What it does

bisect checks out commits between the known-good and known-bad points and waits for you to test, halving the range each time. On a long history this finds the culprit in a few minutes where manual inspection would take hours, and it can be scripted with git bisect run.

03Risk

RiskLow risk
RequirementsGit 2.20+ (install with Homebrew or Xcode Command Line Tools)
CompatibilitymacOS with Git installed (Homebrew or Xcode Command Line Tools)
!Warning: Testing may require building or running code from arbitrary commits; be aware of untrusted build scripts.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • git-bisect documentation
    Git · vendor-doc · 2026-09-20
    Evidence: Documents git bisect, which binary-searches history to find a bad commit.

Last verified: 2026-10-13 · Category: Developer