For Commitizen to work effectively in your development pipeline, commits must follow a consistent convention. By default, Commitizen uses the Conventional Commits specification, which provides a standardized format for commit messages that enables automatic versioning and changelog generation.
You can also create your own custom commit convention by following the customization documentation.
The Conventional Commits specification follows this structure:
Commit types categorize the nature of your changes. The most important types for semantic versioning are:
Other commonly used types include:
Note
While feat and fix directly affect semantic versioning, other types (like build, chore, docs) typically don't trigger version bumps unless they include a BREAKING CHANGE.
Breaking changes trigger a MAJOR version increment. You can indicate breaking changes in two ways:
In the commit body or footer:
In the commit title (when enabled):
To enable this syntax, set breaking_change_exclamation_in_title = true in your configuration. Read more
An optional scope can be added to provide additional context about the area of the codebase affected:
Well-written commit messages are crucial for maintaining a clear project history. When writing commits, consider:
The subject line should be clear and concise (aim for ~50 characters). It should summarize what the commit does in one line.
Good:
Avoid:
Write commit messages in the imperative mood, as if completing the sentence: "If applied, this commit will..."
Good:
Avoid:
Your commits will likely appear in the automatically generated changelog. Write messages that make sense in that context. If you want to exclude a commit from the changelog, use types like build, chore, or ci.
Keep commits focused on a single change. If you introduce multiple related changes, consider squashing them into a single commit. This makes the history cleaner and improves changelog generation.
For complex changes, use the commit body to explain:
| fix(commands): bump error when no user provided | fix: stuff |
| feat(api): add pagination to user list endpoint | feat: commit command introduced |
| docs: update installation instructions | docs: changes |
| refactor(parser): simplify token extraction logic | refactor: code cleanup |
Commitizen supports Unicode characters (including emojis) in commit messages. This is useful if you're using commit message formats that include emojis, such as cz-emoji.
By default, Commitizen uses utf-8 encoding. You can configure a different encoding through the encoding configuration option.