Good commit messages make your history readable and searchable. The Conventional Commits specification provides a standard format that tools can parse to automatically generate changelogs and determine version bumps.
Git
Beginner
8 min read
Commit Message Conventions
Example
# Conventional Commits format:
# <type>(<optional scope>): <description>
#
# [optional body]
#
# [optional footer(s)]
# Types:
# feat: A new feature (triggers MINOR version bump)
# fix: A bug fix (triggers PATCH version bump)
# docs: Documentation changes only
# style: Formatting, missing semicolons — no logic change
# refactor: Code restructuring without feature/fix
# test: Adding or fixing tests
# chore: Build process, dependency updates, tooling
# Examples:
git commit -m "feat(auth): add JWT refresh token support"
git commit -m "fix(api): handle null user in /profile endpoint"
git commit -m "docs: update API authentication section in README"
git commit -m "refactor(db): extract query builder into separate module"
git commit -m "test(auth): add unit tests for token expiry logic"
git commit -m "chore: upgrade eslint to v9"
# Breaking change — add ! and BREAKING CHANGE footer:
# feat!: redesign authentication API
#
# BREAKING CHANGE: The /auth/login endpoint now returns
# a token object instead of a plain string. Update all
# clients to use response.data.token instead of response.data.
# Multi-line body:
# git commit (opens editor)
# fix(checkout): prevent double-charge on payment retry
#
# When a user clicked "Pay" twice quickly, the payment
# gateway was called twice. Added a debounce on the button
# and a server-side idempotency key.
#
# Closes #234