Conventional Commits 1.0.0 defines the commit message structure as follow
<type>[scope][!]: <description>
[body]
[footer(s)]
The complete specifications are available here. The following summary are for personal use only:
- Commit types:
- build: affect the build system or external dependencies.
- chore: generic build-related changes.
- ci: relates to CI configuration files and scripts.
- docs: changes on documentation only.
- feat: introduces a new feature.
- fix: patches a bug.
- perf: improves performance.
- refactor: neither fixes a bug nor adds a feature.
- revert: unapply changes (see example).
- style: tidy up code style.
- test: adds or corrects test.
- Scope: MUST consist of a noun describing a section of the codebase, usually it depends on the repository scopes.
- deps: app dependency.
- gerrit: gerrit-related.
- github: github-related.
- Description: a short summary in present tense without capitalization at the first letter and period at the end.
- Body: imperative, present tense explanation why this changes are made, optionally include the impact of the change.
- Footer:
- BREAKING CHANGE: introduces a breaking API change, appends a
!after the type/scope. - Other footers follow git trailer format convention (
token: value), see git-commit for details.
- BREAKING CHANGE: introduces a breaking API change, appends a
Besides from conventional commits specifications, there are some additional rules to ensure git commit style:
- Separate subject from body with a blank line.
- Limit the subject line to 50 characters.
Capitalise the subject line.- Do not end the subject line with a period.
- Use the imperative mood in the subject line.
- Wrap the body at 72 characters.
- Use the body to explain what and why vs how.
Examples
You can check another examples here at the official website.
feat(config)!: allow provided config object to extend other configs
Introduce a request id and a reference to latest request. Dismiss
incoming responses other than from latest request.
Remove timeouts which were used to mitigate the racing issue but are
obsolete now.
Refs: #123
Fixes: #456
Source-Link: https://blog.avm-martin.my.id/2023/06/commits-v1-tldr.html
Change-Id: Id123456789
Co-Authored-By: AVM <email@example.com>
Reviewed-On: https://blog.avm-martin.my.id/2023/06/commits-v1-tldr.html
Reviewed-By: AVM <email@example.com>
revert: let us never again speak of the noodle incident
Refs: 676104e, a215868
Tools
These are the recommended tools to enforce this standard. It is not mandatory but feel free to explore it. Note that most of the tools are built using javascript.
- commitizen/cz-cli
- conventional-changelog/commitlint
- conventional-changelog/conventional-changelog
- conventional-changelog/releaser-tools
- conventional-changelog/standard-version
- googleapis/release-please
- googleapis/releasetool
- semantic-release/semantic-release