← IndexEntry № 023·coding

Write a Clear Git Commit Message

Generate a Conventional Commits-compliant git commit message with context and rationale.

Optimized for
ClaudeChatGPT
§ When to use this

This prompt turns a plain-English description of a code change into a clean, Conventional Commits–formatted message, complete with a typed subject line and a body that explains the reasoning. It's structured to enforce the parts developers most often skip: keeping the subject short and explaining WHY rather than restating the diff. Use it when you've made a non-trivial change and want a commit message that will still make sense to a teammate (or future you) six months from now.

§ The Prompt— fill in the fields, then copy or open in a tool
§ Customize0/2 fields filled
your prompt — fill the fields above
You are an expert in software engineering best practices. Write a git commit message for the following change. Follow the Conventional Commits spec: type(scope): subject. Keep the subject under 72 characters. Add a body paragraph if the change is non-obvious, explaining WHY (not what). End with any breaking changes noted as BREAKING CHANGE.

CHANGE DESCRIPTION:
[DESCRIBE WHAT YOU DID]

DIFF SUMMARY:
[OPTIONAL: PASTE DIFF]
Open with your prompt →ChatGPTClaudeSends your filled-in prompt straight into a new chat.
§ Example Output

What you can expect back

fix(auth): store session token in httpOnly cookie

The session token was previously kept in localStorage, which is readable
by any script running on the page and therefore exposed to XSS attacks.
The server now sets and clears the token as an httpOnly, Secure cookie,
and the client no longer reads or stores it directly.

BREAKING CHANGE: clients that read the token from localStorage will no
longer find it; the token is sent automatically with requests via cookie.

Illustrative example — your results will vary by tool and inputs.

§ Pro Tips

Get sharper results

  • 01Give it the actual scope (the module or package name) in your description, otherwise it guesses a generic scope like (app) that's less useful in a monorepo.
  • 02Paste at least `git diff --stat` so the model picks the right Conventional Commit type — without it, refactors often get mislabeled as feat.
  • 03If the change is genuinely trivial, tell it 'no body needed' so you get a one-line message instead of an invented paragraph.
  • 04When you have several unrelated changes staged, ask it to split them into multiple commit messages so you can commit them separately and keep history clean.
  • 05Add your team's allowed type list (e.g. feat, fix, chore, docs, refactor) if you use commitlint, so the output passes your CI hook on the first try.
§ Variations

Adapt it for your case

PR description too

Append 'then expand this into a pull request description with a testing-notes section' to generate both at once.

Emoji / gitmoji style

Add 'prefix the subject with the matching gitmoji' if your team uses the gitmoji convention.

Changelog-ready

Ask it to also produce a one-line user-facing changelog entry derived from the commit.

Use For — Tasks
Tags#git#commits#engineering
§ FAQ

Common questions

What are the valid Conventional Commit types?

Common ones are feat, fix, chore, docs, style, refactor, perf, test, build, and ci. List the exact set your team uses in the prompt so the output matches your lint rules.

When should it add a BREAKING CHANGE footer?

Only when the change alters a public API, contract, or behavior that other code depends on. Mention in your description whether the change is backward-compatible so it judges this correctly.

Do I have to paste the diff?

No, it's optional. A clear one-sentence description is usually enough, but pasting the diff stat helps it pick the right type and scope.

§ Related Entries

You may also need