Bisect (Find Bugs) in Git

From the Git cheat sheet · Advanced Techniques · verified Nov 2026

Bisect (Find Bugs)

Binary search through history to find the commit that introduced a bug

bash
# Start bisect
git bisect start
git bisect bad          # Current commit is bad
git bisect good <commit>  # Known good commit

# Test each commit
git bisect good         # Mark as good
git bisect bad          # Mark as bad

# Finish
git bisect reset
💡 Finds bugs using binary search
⚡ Automate with test scripts
✅ Efficiently narrows down problem commits
📌 For bisect run: exit 0 = good, 125 = skip, 1-127 = bad

Continue with Git

Save the full cheat sheet or work through every related task.

More Git tasks

Back to the full Git cheat sheet