Overview
LLMs can generate clear, conventional commit messages from git diffs. Provide the diff and specify the commit convention to get consistent, meaningful messages that explain the "why" behind changes.
Commit Message Prompt Template
Generate a commit message for this diff using Conventional Commits.
Rules:
- Format: type(scope): description
- Types: feat, fix, chore, docs, refactor, test, style, ci, perf
- Subject line under 72 characters, focused on WHY not WHAT
- Add body with bullet points for complex changes
Diff:
```diff
[paste git diff]
```Conventional Commit Types
| Type | When to Use | Example |
|---|---|---|
| feat | New feature | feat(auth): add Google OAuth login |
| fix | Bug fix | fix(api): handle null user in /profile |
| chore | Maintenance | chore(deps): update typescript to 5.9 |
| docs | Documentation | docs(readme): add deployment instructions |
| refactor | Code restructure | refactor(utils): extract date formatting |
| test | Tests only | test(auth): add login flow integration tests |
Multi-Change Commits
If a diff contains multiple logical changes, ask the LLM whether it should be one commit or split into multiple. Follow the single-responsibility principle for commits — each commit should represent one logical change.