To find a problematic commit using binary search
# 1. Start git bisect
git bisect start
# 2. Mark current broken state as bad
git bisect bad
# 3. Mark last known good commit as good (replace hash with your working commit)
git bisect good <commit-hash>
# 4. Git will checkout commits automatically. Test and mark each one:
npm test # replace with your test command
git bisect good # if it works
# or
git bisect bad # if it's broken
# Repeat until git finds the problematic commit
# 5. When done, reset bisect
git bisect resetAlternatively, if your test command returns 0/1 exit code,
git bisect start
git bisect bad
git bisect good <good-commit>
git bisect run npm test # replace with your test command