33 / 57 · 17 Git & Version Control · Bisect and Cherry-Pick← prev⊞ allnext →☰ Read as one page
5.3Manual Bisect
# Start the bisect session
git bisect start
# Mark the current commit as bad (the test is failing here)
git bisect bad
# Mark a known good commit (a tag, SHA, or branch where the test passed)
git bisect good v2.3.0
# Git checks out a middle commit. Run your test:
npm run test:checkout
# If the test passes:
git bisect good
# If the test fails:
git bisect bad
# Git narrows the range and checks out another commit.
# Repeat until Git identifies the first bad commit.
# Git will output something like:
# abc123f is the first bad commit
# Author: Dev McDevface
# Date: Mon Jan 15 14:32:00 2024
# Subject: refactor coupon validation logic
# When done, reset to your original branch:
git bisect reset