Write Conventional Commit Messages from a Pasted Git Diff

Paste a Git diff and get conventional commit messages with 50-character subjects and bodies that explain why, plus a split plan when the changes are unrelated.

You getSplit decision and for each commit

Prompt

Prompt
You are a senior software engineer who reviews commits for a team that uses Conventional Commits.

I will paste a Git diff (from git diff or git diff --staged) right after this message. Write the commit message or messages for it.

Rules:
1. The subject uses type(scope): summary. Type is one of feat, fix, refactor, docs, test, chore, perf, style, build or ci. The whole subject is 50 characters or fewer, in imperative mood, with no trailing period.
2. Wrap the body at 72 characters. Explain why the change was made and what problem it solves. Describe what changed only when the diff does not make it obvious.
3. If the diff mixes unrelated changes, split it into separate commits. For each commit, list its files or hunks and give the staging commands. Use git add -p when one file mixes concerns.
4. Add a BREAKING CHANGE: footer only if the diff changes a public API, a config key or behavior that callers rely on.
5. If the reason for a change cannot be read from the diff, give your best guess and mark it (verify).

Output format:
- Split decision: one line stating single commit or N commits, and why.
- For each commit: a heading "Commit N", the files or hunks it includes, the staging commands, the full message in a code block, and the subject's character count.

End with one line listing what you assumed or could not tell from the diff.

Example output

At a glanceSubject length of each split commitOne diff split into 3 commits, each subject under 50 characters
  • fix(api): retry on 429: 47 chars
  • docs(readme): fix install typo: 38 chars
  • build(deps): bump axios: 43 chars

Example for: a TypeScript API client diff that touches retry logic, a README typo and an axios version bump.

Split decision: 3 commits. The retry fix, the docs typo and the dependency bump are unrelated and should be reverted independently.

Commit 1

Includes: src/api/client.ts, src/api/client.test.ts

git add src/api/client.ts src/api/client.test.ts
git commit
fix(api): retry on 429 using Retry-After header

The client retried rate-limited requests after a fixed 500 ms delay,
which hit the limit again and failed bulk imports after 3 attempts.

Read the Retry-After header when present and wait that long before
retrying, capped at 30 seconds. Fall back to exponential backoff
when the header is missing. (verify: the 30 s cap is a guess based
on the MAX_WAIT_MS constant.)

Tests cover header present, header missing and cap exceeded.

Subject length: 47 characters

Commit 2

Includes: README.md

git add README.md
git commit
docs(readme): fix install command typo

The install step said "npm instal", so copy-pasted setup failed for
new contributors.

Subject length: 38 characters

Commit 3

Includes: package.json, package-lock.json

git add package.json package-lock.json
git commit
build(deps): bump axios from 1.6.2 to 1.7.4

Picks up upstream fixes for request handling. No code changes were
needed; the existing test suite passes on the new version. (verify:
the reason for the bump is not visible in the diff.)

Subject length: 43 characters

Assumptions: I could not tell from the diff why axios was bumped or whether the 30-second cap matches the API's documented limit. Check both before pushing.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • A hard 50-character subject limit with a reported count keeps git log readable and makes the rule easy to check.
  • Requiring the body to explain why gives reviewers the reasoning the diff cannot show.
  • Flagging guesses with (verify) stops the model from presenting invented reasons as facts.

Use before committing messy work. Run git diff --staged or git diff, then paste the output into ChatGPT, Claude or Gemini right after the prompt. Remove any secrets or keys first.

Common edits

  • Swap the type list for your team's own commit types or add a required ticket ID footer.
  • Ask for a single squash-merge message instead of a split plan when merging a pull request.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Coding