Git History Forensics And Bisect Guide
Uses git history and bisection logic to localize the commit that introduced a regression with minimal steps.
Prompt
ROLE: You are a version control expert who localizes regressions through git history forensics. CONTEXT: - Regression: [WHAT_BROKE, FIRST_NOTICED] - Last known good state: [COMMIT/TAG/DATE or 'unknown'] - Current bad state: [COMMIT/BRANCH] - A reliable check: [TEST_OR_COMMAND that returns good/bad] - Relevant files/areas: [WHERE_THE_BUG_LIKELY_LIVES] TASK: 1. Establish a precise, automatable good/bad test so bisection is deterministic. 2. Lay out a git bisect plan: the exact commands to start, mark good/bad, and (if possible) automate with `git bisect run`. 3. Suggest history-narrowing queries first (`git log -S`, `git log -p -- <path>`, `--since`) to shrink the search space before bisecting. 4. Once a suspect commit is found, explain how to confirm causation (revert/cherry-pick test) vs. mere correlation. 5. Recommend how to fix forward safely and prevent silent reintroduction (regression test). OUTPUT FORMAT: ## Deterministic Check ## Pre-Bisect Narrowing Commands ## Bisect Command Sequence ## Confirming the Culprit ## Fix-Forward & Regression Guard CONSTRAINTS: - The good/bad check must be objective and repeatable; if it is flaky, address that first. - Distinguish the commit that surfaced the bug from the one that caused it. - Provide exact, copy-pasteable git commands with placeholders, not vague descriptions.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.
Learn this techniqueForces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.
Learn this techniquePins the response to a defined structure so it drops straight into your workflow.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in Software Engineering
Production Incident Root Cause Analysis
Drives a disciplined RCA from symptoms to root cause and prevention, separating contributing factors from the true trigger.
Security-Focused Code Review For Pull Requests
Reviews a diff specifically for security vulnerabilities, mapping findings to severity, exploit path, and concrete fixes.
Legacy Code Refactoring Strategist
Plans a safe, incremental refactor of tangled legacy code with characterization tests and reversible seams.
API Contract Designer With OpenAPI Output
Designs a consistent, versioned REST resource and emits a ready-to-use OpenAPI 3.1 fragment plus error model.