Sub topic 13
Common mistakes and tips for adopting the convention
This chapter assumes you know the Conventional Commits structure (type, scope, description, body, footers), the mapping to Semantic Versioning, and the basics of a commit-msg hook or commitlint. It covers the errors teams hit most often and how to roll the convention out without friction.
Common mistakes
Picking the wrong type
The type drives version bumps and changelog sections, so a wrong type has real effects. Typical errors:
- Using
featfor anything new inside the code, such as an internal helper. Reservefeatfor new behavior that users of the software can see. - Using
fixfor a refactor that happens to touch buggy code. If behavior does not change, userefactor. - Using
choreas a catch-all. A change to build scripts isbuild, a change to pipelines isci, and a change to documentation isdocs.
Forgetting the breaking-change marker
A breaking change committed as plain feat or fix produces a MINOR or PATCH release. Consumers then upgrade and break. Add ! before the colon, a BREAKING CHANGE: footer, or both. The footer token must be uppercase and must be followed by a description.
refactor(config)!: rename the timeout option to requestTimeout
BREAKING CHANGE: the timeout option is no longer read. Use requestTimeout.Mixing several changes in one commit
A commit holds one type. If a commit fixes a bug and adds a feature, the history can show only one of them, and tools may miss the other. Split the work with git add -p and make two commits.
Vague or oversized descriptions
Descriptions such as fix: stuff or feat: update give a reader nothing. A good description is short, in the imperative mood, and says what changed: fix: prevent crash when the config file is empty. Keep the first line near 50 to 72 characters and put details in the body.
Squash merges that discard the message
With squash merges, the commit that lands on the main branch is the one that matters. Many hosting platforms build its subject from the pull request title or from the first commit. If the title is Update stuff, the clean commits on the branch are lost. Lint the pull request title, or check the final squash message, instead of only the individual commits.
Rolling the convention out
- Start with a short guide. Put the allowed types and scopes in
CONTRIBUTING.md, with two or three real examples from your project. - Agree on a scope list. Free-form scopes drift (
api,API,rest-api). Pick a list and encode it in the linter. - Enforce locally and in CI. A local hook gives fast feedback. A CI check catches commits that skipped the hook, since hooks are not copied when someone clones the repository and can be bypassed with
--no-verify. - Warn first, then fail. Run the check in report-only mode for a week or two so people can learn the format, then make it block merges.
- Do not rewrite old history. Apply the convention from a chosen commit onward. Rewriting shared history breaks everyone's clones. Tell your release tool where to start instead.
You can check how well the convention is holding up with plain git log:
# commits on main that do not follow the pattern
git log --oneline --invert-grep \
--grep='^\(feat\|fix\|docs\|style\|refactor\|perf\|test\|build\|ci\|chore\|revert\)\((.*)\)\?!\?: 'A quick review checklist
| Question | If the answer is no |
|---|---|
| Does the type match the real effect of the change? | Change the type |
| Is the commit about one thing? | Split it |
| Is any user-visible break flagged with `!` or `BREAKING CHANGE`? | Add the marker |
| Does the description read clearly without the diff? | Rewrite it |
| Does the squash message or PR title follow the format? | Edit it before merging |
Exercise
Your team squash-merges pull requests. Every commit on the feature branch passes commitlint locally, but the main branch history still shows messages like "Update login page". What is the likely cause, and what is one fix?
Show answer
The squash commit takes its subject from the pull request title, which is not checked. Add a CI check that lints the PR title against the same conventional ruleset, or set the platform to use the PR title as the squash commit subject and enforce the format on that title.
Exercise
A commit removes a public function that other packages call, and its message is "refactor(utils): drop legacy helper". Which release type will an automated tool produce, and how should the message change?
Show answer
The tool will most likely produce no release or a PATCH release, because refactor does not trigger a MAJOR bump. Change the message to "refactor(utils)!: drop legacy helper" and add a "BREAKING CHANGE:" footer explaining what callers should use instead. The tool will then produce a MAJOR release.