How to Write a Commit Message

The Conventional Commits format, seven rules, real examples, and a free generator.

A good commit message answers two questions: what changed and why. The diff already shows how. This guide covers the Conventional Commits format, shows real examples, and links a free generator so you never start from a blank commit message again.

The Conventional Commits format

type(scope): subject

body

footer

The seven rules of a great commit message

  1. Separate subject from body with a blank line.
  2. Limit the subject line to 50 characters (hard cap 72).
  3. Capitalize the subject line (or keep it lowercase for conventional commits — pick one and be consistent).
  4. Do not end the subject line with a period.
  5. Use the imperative mood in the subject ("add", "fix", "update" — not "added" or "fixes"). The message should complete the sentence "If applied, this commit will ___."
  6. Wrap the body at 72 characters.
  7. Use the body to explain what and why, not how.

Real examples

Feature

feat(auth): add rate limiting to the login endpoint

prevents brute-force attacks on user accounts
adds a 5-requests-per-minute limit per IP
returns 429 with a Retry-After header when exceeded

Closes #142

Bug fix

fix(parser): handle null values in nested config

the parser threw on null children of a config node;
now treats null as an empty object and continues

Breaking change

feat(auth)!: require CAPTCHA token on login

BREAKING CHANGE: the login endpoint now requires a
`captcha_token` field in the request body.

Small change (header only)

docs: clarify the API rate limit in the README

The type cheat sheet

TypeUse it when…
featyou add a new feature for the user
fixyou patch a bug
docsdocumentation only (README, comments)
styleformatting, whitespace (no logic change)
refactorrestructure code without changing behavior
perfimprove performance
testadd or fix tests
buildbuild system or dependencies
ciCI pipeline configuration
choretooling, config, misc
revertrevert a prior commit

Why it matters

Conventional commits aren't just style. They let tooling auto-generate changelogs, auto-bump semantic versions (feat: → minor, fix: → patch, !/BREAKING CHANGE: → major), and make a large codebase's history greppable: git log --grep "^fix(" finds every bug fix.

Free Commit Message Generator

Don't want to format it by hand? Our free generator turns a plain-English description of your change into four clean variants — standard Conventional Commit, breaking-change shorthand, a minimal header, and a gitmoji-styled version. No signup, no cost.

Open the Commit Message Generator →

More free developer tools