commit
Usage¶
Overview¶

Thecommit 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 thecustomization guide for details.
Basic Usage¶
Interactive Commit Creation¶
Simply runcz 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.
Writing Messages to File¶
You can save the generated commit message to a file using:
czcommit--write-message-to-fileCOMMIT_MSG_FILEThis can be combined with--dry-run to only write the message without creating a commit. This is particularly useful forautomatically preparing commit messages.
Advanced Features¶
Git Command Options¶
You can pass any git commit options using the-- syntax:
czcommit<commitizen-args>--<git-cli-args># Examples:czc--dry-run---a-S# Stage all changes and sign the commitczc-a---n# Stage all changes and skip the pre-commit and commit-msg hooksWarning
The--signoff option (or-s) is now recommended being used with the new syntax:cz commit -- -s. The old syntaxcz commit --signoff is deprecated and will be removed in v5.
Retry¶
- 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
Message Length Control¶
Control the length of your commit messages using the-l or--message-length-limit option:
czcommit-l72# Limits message length to 72 charactersNote
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.
Technical Notes¶
For platform compatibility, thecommit command disables ANSI escaping in its output. This means pre-commit hooks coloring will be deactivated as discussed incommitizen-tools/commitizen#417.