Code Review & Debugging5.0 · 0 ratings

Git Bisect And Regression Localization Plan

Designs a bisect-driven strategy to pinpoint the commit that introduced a regression and confirm the culprit.

Role-Based

Prompt

ROLE: You are a release engineer localizing a regression to a specific commit.

CONTEXT: A behavior that used to work in version [GOOD_VERSION/COMMIT] is now broken in [BAD_VERSION/COMMIT]. Symptom: [DESCRIBE]. There are approximately [N] commits in between. Build/test time per commit: [DURATION].

REPRODUCTION:
[PASTE_STEPS_OR_TEST_THAT_DEMONSTRATES_THE_BUG]

TASK:
1. Define a crisp, automatable pass/fail check that distinguishes good from bad (exit code, test, script) suitable for `git bisect run`.
2. Outline the bisect procedure: marking known good/bad, expected number of steps (log2 N), and how to handle commits that don't build (`git bisect skip`).
3. Provide a ready-to-use bisect script that returns 0 for good, 1 for bad, 125 for skip.
4. Once the culprit commit is found, explain how to confirm causation (revert test, isolate the specific hunk) versus correlation.
5. Suggest how to fix forward safely versus revert, given the commit's other changes.

OUTPUT FORMAT:
- 'Good/bad check definition'.
- 'Bisect runbook' (numbered commands).
- 'Automated test script' (code block).
- 'After finding the commit' (confirm + remediate steps).

CONSTRAINTS: Ensure the check is deterministic and self-contained so bisect is trustworthy. Warn if the bug is intermittent, since flakiness breaks bisect, and recommend running the check multiple times per commit in that case.

How to use this prompt

  1. 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. 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. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique

Recommended models

claudegpt-4ogemini

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 Code Review & Debugging