When to use it
Use this prompt before committing a change you have been working on for a while, when you want a consistent history across a team, or when you are cleaning up a branch before opening a pull request. A good commit message saves time months later, when someone runs git blame and needs to know why a line exists. Many editors now generate messages automatically; this prompt gives you more control over the convention and the “why”.
How to customize it
- [CONVENTION] should match your repository. Check recent history with
git log --onelineand describe the pattern you see. - [WHY I MADE THIS CHANGE] is the part a diff cannot show. One sentence from you makes the body far more useful than anything the model can infer.
- [RELATED TICKET] links the commit to your tracker. Leave it as “none” rather than letting the model guess.
- [PASTE DIFF] works best with
git diff --stagedso the message matches exactly what you are committing.
Why it works
A diff shows what changed but rarely why. By asking you for the reason and forbidding invented details, the prompt keeps the message accurate. The formatting rules (imperative subject, 72-character lines, blank line before the body) follow widely used git conventions, which keep messages readable in terminals, review tools and changelogs.
The instruction to flag mixed changes is useful beyond the message itself. Small, focused commits are easier to review and to revert, and a model is good at noticing when a diff contains formatting noise or an unrelated fix. For more ways to fit assistants into your workflow, see our guide on using AI coding assistants effectively.
Tips and variations
- Read the message before committing; the model can misjudge the intent of a change.
- For very large diffs, paste
git diff --staged --statplus the most important files. - Ask for a pull request description in the same step: summary, testing done, screenshots needed.
- Generate release notes from a range of commits with
git log [FROM]..[TO]as input. - Remove secrets and credentials from diffs before pasting them anywhere.