Use git bisect with Claude to Track Down Regressions Fast
When a bug appeared somewhere in the last 200 commits, manual hunting is a nightmare. Ask Claude to help you set up a git bisect session — it writes the automated bisect script, interprets the results, and explains exactly what the offending commit changed.
git bisect start
git bisect bad HEAD # Current commit is broken
git bisect good v2.3.0 # This release was fine
Ask Claude to write a bisect test script for your test suite:
#!/bin/bash
# Claude-generated bisect runner
npm run build --silent 2>/dev/null
npm test -- --testPathPattern="checkout" --silent
exit $? # 0 = good commit, non-zero = bad commit
chmod +x bisect-test.sh
git bisect run ./bisect-test.sh
# Git automatically narrows to the exact bad commit
Once bisect identifies the commit, paste the diff straight into Claude and ask: "What change in this commit would cause the checkout tests to fail, and what's the minimal fix?" Claude reads the diff in full and gives you a targeted explanation rather than a generic guess.
This also works for performance regressions — write a bisect script that benchmarks a critical path and exits non-zero if it's slower than a threshold, then let git and Claude do the hunting together.
git bisect narrows it to one commit — Claude explains exactly what went wrong and why.
Log in to leave a comment.
When a page takes five seconds to load or an API endpoint times out under load, tell Claude which route is slow and it traces the entire code path — controller, services, queries, loops — identifying N+1 queries, redundant computations, missing indexes, and cacheable operations, then fixes each bottleneck.
Flaky tests are maddening — they pass locally, fail in CI, pass again when you retry. Tell Claude to read the test, identify the source of non-determinism — timing issues, shared state, date dependencies, or order-dependent setup — and fix the root cause so the test is reliably green or reliably red.
When your app throws an error, don't just Google the message — paste the full stack trace into Claude Code. It reads the trace, opens the referenced files in your codebase, follows the call chain, and pinpoints the actual root cause instead of just explaining the symptom.