Prompt Library coding beginner

ChatGPT Prompts for Git Commits: Conventional Commits Made Easy

ChatGPT prompts for writing clear git commit messages. Conventional commits format, atomic commit strategies, and changelog generation from git history.

Tested on: GPT-4oClaude 4Gemini 2.5

The Prompt

Act as a software engineer who enforces clean git history practices on high-velocity engineering teams.
Write git commit messages for:
Changes made: {describe or paste the diff summary}
Repository context: {what this codebase is — helps calibrate scope}
Commit convention: {Conventional Commits / Semantic / free-form}
PR/ticket reference: {ticket or PR number — or "none"}
Scope of change: {feature / bug fix / refactor / docs / test / chore / performance}

Output:
1. Subject line (under 72 characters — format: type(scope): description)
2. Commit body (optional — when and why, not what — under 72 chars per line):
   - Motivation: why this change was made
   - Context: what would a reviewer need to know that's not obvious from the code
   - Side effects: any non-obvious consequences of this change
3. Footer (Breaking changes, closes issue references)
4. 3 alternative subject lines (different phrasings for the same change)

For CHANGELOG generation — if given a list of commits, format as:
## [version] - date
### Added | Changed | Deprecated | Removed | Fixed | Security
- Change description (commit reference)

Constraints:
- Subject line must use imperative mood ("add feature" not "added feature" or "adds feature")
- Body must explain WHY, not WHAT (the code shows what — the commit message explains why)
- Breaking changes must be flagged with BREAKING CHANGE in the footer
- No emoji in the subject line (breaks some tooling and changelog parsers)
- Avoid: "fix bug", "update code", "misc changes" — be specific

Variables to fill in

  • {changes made} Description or diff summary of what changed
  • {commit convention} Conventional Commits, Semantic, or free-form
  • {scope of change} Feature, bug fix, refactor, docs, test, chore, or performance
  • {ticket reference} Jira/GitHub ticket or PR number

How to use this prompt

  1. Paste your git diff summary to generate the subject line and body
  2. Use the changelog generation format at release time to produce release notes automatically
  3. Share the conventions section with your team as your commit message style guide
  4. Set up a commit-msg git hook to validate the format before commits are accepted
Git log with clean conventional commit messages in terminal
Photo by Roman Synkevych on Unsplash

Commit messages are letters to your future self

A commit message written at 11pm on a deadline makes perfect sense in that moment. Six months later, when you’re bisecting git history to find when a regression was introduced, ‘fix stuff’ tells you nothing. The prompt’s constraint — body explains WHY, not WHAT — is the discipline that makes git history a useful debugging tool.

Imperative mood is a convention with a functional reason

Conventional Commits specifies imperative mood (‘add’, not ‘added’ or ‘adds’) because it matches how Git itself describes changes: ‘Merge branch X’, ‘Revert commit Y’. A commit log that mixes imperative and past tense is harder to parse programmatically — which matters for tools that auto-generate changelogs.

BREAKING CHANGE flags are how your users learn about API changes

For libraries and APIs, a BREAKING CHANGE footer in a commit message is the signal that downstream tooling (semantic-release, conventional-changelog) uses to bump major version numbers and generate migration notes. A breaking change that ships without this flag causes silent breakage for every consumer of your package.