CLSkills
Git & Version Controladvanced

Git Bisect Helper

Share

Automate git bisect to find the commit that introduced a bug

Git Bisect Helper

Automate git bisect to find the commit that introduced a bug

Automate git bisect to find the commit that introduced a bug.

Instructions

  1. Identify a "good" commit (where the bug didn't exist):
git log --oneline -20  # find a known good point
  1. Start bisect:
git bisect start
git bisect bad                    # current commit is bad
git bisect good <good-commit>    # known good commit
  1. At each step, test if the bug exists:

    • Run the failing test: npm test -- --grep "test name"
    • Or check manually
    • Then mark: git bisect good or git bisect bad
  2. Automated bisect (if you have a test):

git bisect run npm test -- --grep "failing test name"
# Or with a custom script:
git bisect run bash -c 'npm run build && npm test'
  1. When bisect finds the commit:
git show <bad-commit>    # review the culprit
git bisect reset         # return to original branch

Tips

  • If a step can't be tested (e.g., won't compile): git bisect skip
  • Bisect is O(log n) — 1000 commits takes ~10 steps

Quick Info

Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
gitbisectdebugging

Install command:

curl -o ~/.claude/skills/git-bisect-helper.md https://claude-skills-hub.vercel.app/skills/git/git-bisect-helper.md