Git Commit Message Typing Practice
A well-formed commit message is one of the most-typed things in a developer's day. This guide covers the Conventional Commits format, every commit type with examples, and the difference between clear and vague messages.
Conventional Commits Format
type(scope): short description
[optional body]
[optional footer: BREAKING CHANGE or closes #123]
[optional body]
[optional footer: BREAKING CHANGE or closes #123]
- type — one of the commit types below (required)
- scope — optional area of the codebase (auth, api, cart, ui…)
- description — imperative present tense, under 72 chars, no period
- ! after type/scope signals a breaking change
Commit Type Reference
| Type | Example |
|---|---|
feat | feat: add OAuth login with Google |
fix | fix: resolve null pointer on empty cart |
docs | docs: update API authentication guide |
style | style: apply eslint auto-fix across src/ |
refactor | refactor: extract auth logic to useAuth hook |
test | test: add unit tests for price calculator |
chore | chore: bump react to 19.0.0 |
perf | perf: memoize expensive filter on product list |
ci | ci: add Node 20 to build matrix |
Good vs Bad Commit Messages
Good
feat(auth): add JWT refresh token rotationfix(cart): prevent duplicate item on fast clickrefactor(api): split user route into auth and profilechore: upgrade eslint to v9 and apply flat configfeat!: drop support for Node 16 — BREAKING CHANGEBad
fix stuffupdateswipdonechanged things in the auth module to make it work betterHOTFIXA good commit message answers "what changed and why" in one line. It should make sense in a git log without opening the diff.
Quick Rules
- →Use the imperative mood: "add" not "added" or "adds"
- →Keep the subject line under 72 characters
- →No period at the end of the subject line
- →Separate subject and body with a blank line
- →Use the body to explain why, not what (the diff shows what)
- →Reference issues in the footer:
closes #42
Improve Your Overall Typing Speed
Writing great commit messages is a typing task too. Build the fluency that makes every line of code — and every commit — faster to produce.
Take the typing test →Related tools