The commit command provides an interactive way to create structured commits. Use either:
cz commitcz c(shortcut)
By default, Commitizen uses conventional commits, but you can customize the commit rules to match your project's needs. See the customization guide for details.
Simply run cz commit in your terminal to start the interactive commit creation process. The command will guide you through creating a properly formatted commit message according to your configured rules.
You can save the generated commit message to a file using:
cz commit --write-message-to-file COMMIT_MSG_FILEThis can be combined with --dry-run to only write the message without creating a commit. This is particularly useful for automatically preparing commit messages.
Commitizen now supports enhanced multiline input for commit messages, making it easier to create detailed, well-structured commits.
When prompted for input during cz commit, you can now use multiline input with smart behavior:
- Enter on empty line → Skips the field
- Enter after typing content → Adds a new line for multiline input
- Alt+Enter → Finishes and submits the input
- Enter on empty line → Shows error message with options:
⚠ This field is required. Please enter some content or press Ctrl+C to abort. > - Enter after typing content → Adds a new line for multiline input
- Alt+Enter → Finishes and submits the input
- Ctrl+C → Aborts the commit session
cz commitDuring the interactive process:
- Commit Type: Select from the list (e.g.,
feat,fix,docs) - Scope (optional): Press Enter to skip, or type scope and use Enter for multiline
- Subject (required): Must enter content, can use Enter for multiline, Alt+Enter to finish
- Body (optional): Press Enter to skip, or add detailed description with multiline support
- Breaking Change: Yes/No confirmation
- Footer (optional): Press Enter to skip, or add references/notes with multiline support
You can pass any git commit options using the -- syntax:
cz commit <commitizen-args> -- <git-cli-args>
# Examples:
cz c --dry-run -- -a -S # Stage all changes and sign the commit
cz c -a -- -n # Stage all changes and skip the pre-commit and commit-msg hooks!!! warning
The --signoff option (or -s) is now recommended being used with the new syntax: cz commit -- -s. The old syntax cz commit --signoff is deprecated and will be removed in v5.
- Use
cz commit --retryto reuse the last commit message after a failed commit attempt - Set
retry_after_failure: truein your configuration to automatically retry - Use
cz commit --no-retryto force a new commit message prompt
Control the length of your commit messages using the -l or --message-length-limit option:
cz commit -l 72 # Limits message length to 72 characters!!! note The length limit only applies to the first line of the commit message. For conventional commits, this means the limit applies from the type of change through the subject. The body and footer are not counted.
For platform compatibility, the commit command disables ANSI escaping in its output. This means pre-commit hooks coloring will be deactivated as discussed in commitizen-tools/commitizen#417.
