Format git commit messages following Conventional Commits 1.0.0 specification. Use when the user asks to commit changes, create a git commit, or mentions committing code...
Format all git commit messages according to the Conventional Commits 1.0.0 specification.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
| Type | When to Use | SemVer |
|---|---|---|
feat |
New feature | MINOR |
fix |
Bug fix | PATCH |
docs |
Documentation only | - |
style |
Formatting, whitespace (no code change) | - |
refactor |
Code restructuring (no feature/fix) | - |
perf |
Performance improvement | - |
test |
Adding/fixing tests | - |
build |
Build system, dependencies | - |
ci |
CI/CD configuration | - |
chore |
Maintenance, tooling | - |
revert |
Reverting previous commit | - |
When determining commit type, ask:
featfixdocsperfrefactorstyletestbuildcichorefeat(auth):, fix(api):, docs(readme):Fixes #123 - Reference issuesCo-authored-by: Name <email> - Credit contributorsBREAKING CHANGE: description - Breaking changesRefs: #456, #789 - Related issuesIndicate breaking changes using either method:
feat!: remove deprecated API endpoint
feat(api)!: change authentication flow
fix: update validation logic
BREAKING CHANGE: validation now rejects empty strings
Critical: Use single quotes to avoid shell escaping issues with !:
# Correct - single quotes
git commit -m 'feat!: add new authentication flow'
# Incorrect - backslash escaping (DO NOT USE)
git commit -m "feat\!: add new authentication flow"
For multi-line messages, use HEREDOC:
git commit -m "$(cat <<'EOF'
feat(auth): add OAuth2 support
Implement OAuth2 authentication flow with support for
Google and GitHub providers.
BREAKING CHANGE: removes legacy session-based auth
EOF
)"
git diff --cached --statgit add firstgit diff --cachedgit log --oneline -5git log -1Before committing, verify:
! suffix or BREAKING CHANGE: footerSimple fix:
fix: prevent null pointer in user lookup
Feature with scope:
feat(api): add rate limiting to endpoints
With body:
refactor: extract validation into separate module
Move validation logic from controllers to dedicated
validator classes for better testability and reuse.
Breaking change:
feat!: upgrade to v2 API format
BREAKING CHANGE: response structure changed from
{data: [...]} to {items: [...], meta: {...}}
With issue reference:
fix(auth): resolve token refresh race condition
Fixes #234
For the complete Conventional Commits 1.0.0 specification including all rules and FAQ, see references/full-spec.md.