Skip to content
git

Write clear commit messages and a clean PR description from a diff

Turns a raw git diff into properly scoped conventional commit messages and a PR description that explains why the change was made, not just what changed.

Who should use this

Is this prompt for you?

  • Developers who tend to write vague commit messages under deadline pressure
  • Teams enforcing a conventional commits or changelog-driven workflow
  • Anyone opening a pull request who wants reviewers to actually understand the change quickly
The prompt

Copy this prompt

Prompt
Look at this git diff and help me write clear commit messages and a PR description.

Diff: [paste the output of `git diff` or `git diff --staged`]
Branch/PR context: [what this change is for, e.g. "fixes a checkout bug reported in issue #482" or "adds the invite-teammate feature"]
Commit convention: [Conventional Commits (feat/fix/chore/refactor/docs/test) / your team's own style — specify, or say "no strict convention"]

Do the following:
1. If this diff actually contains multiple unrelated changes, tell me — don't force it into one commit message. Suggest how I should have split it into separate commits instead.
2. Write a commit message (or one per logical change) following the specified convention: a short imperative summary line (under ~72 characters), a blank line, then a body explaining WHY the change was made and any tradeoffs — not a restatement of the diff line by line
3. Flag anything in the diff that looks like it shouldn't be committed — debug console.logs, commented-out code, secrets/API keys, unrelated formatting-only changes mixed into a logic change
4. Write a PR description with: a one-paragraph summary of the change and why, a "how to test this" section with concrete steps, and a checklist of anything the reviewer should pay special attention to (e.g. "this touches the payment retry logic — please check the idempotency handling")
5. If the diff fixes a bug, make sure the commit message and PR description explain the root cause, not just "fixed bug"

Keep the tone factual and specific — no vague phrases like "various improvements" or "minor changes."

Works well with Claude Code, GitHub Copilot and Cursor.

How to use it

Getting the best result

  1. 1Paste the real diff, not a description of your changes — the AI needs to see what actually changed
  2. 2Tell it your team's actual commit convention (or lack of one) so the format matches what your repo already uses
  3. 3Split the diff into separate commits yourself if it flags unrelated changes bundled together
  4. 4Remove anything it flags as "shouldn't be committed" before pushing, don't just note it and move on
Expected result

What you should get back

  • A clear statement of whether the diff should be one commit or several, with reasoning
  • Conventional, well-scoped commit message(s) explaining why the change was made, not just what changed
  • A flagged list of anything suspicious in the diff — debug code, secrets, unrelated changes
  • A PR description with a summary, concrete test steps, and a reviewer checklist
Tips

Get more out of this prompt

  • Run this on the staged diff right before committing, not after — it's much easier to still split commits at that point
  • Always double check the "shouldn't be committed" flags yourself; accidentally committed secrets need rotating, not just removing
  • Ask for the PR description's test steps to be concrete enough that someone unfamiliar with the change could actually follow them
Common mistakes

What to watch out for

  • Forcing multiple unrelated changes into one vague commit message instead of splitting the diff
  • Writing a commit message that restates the diff ("changed function X") instead of explaining why
  • Not checking for accidentally committed secrets or debug code before pushing

Ready to put this prompt to work?

Pair it with an AI coding tool and a real project, then ship something this week.