The git-cz CLI provides a command-line interface for creating semantic commits with interactive prompts and comprehensive configuration options.
The CLI is available through two executable commands that provide identical functionality.
# Primary command
git-cz [options]
# Alternative command
gitcz [options]CLI Options:
-h, --help - Show usage information-v, --version - Print version info and exit--disable-emoji - Don't add emoji to commit title--format - Custom formatting options for subject--non-interactive - Run git-cz in non-interactive mode--dry-run - Show what would be executed without running git commit--hook - Exit after writing commit message file (for git hooks)When using --non-interactive, these additional options are available:
--type - Type of the commit, defaults to "chore"--subject - Message of the commit, defaults to "automated commit"--scope - Semantic commit scope--body - Extended description of the commit--breaking - Description of breaking changes, if any--issues - GitHub issues this commit closed, e.g "#123"--lerna - Lerna mono-repo packages this commit affectsAll additional arguments are passed through to the underlying git commit command.
# Pass-through examples
git-cz --amend # Passes --amend to git commit
git-cz -a # Passes -a to git commit
git-cz --allow-empty # Passes --allow-empty to git commit# Basic interactive usage
git-cz
# Interactive with emoji disabled
git-cz --disable-emoji
# Interactive dry-run to see what would be executed
git-cz --dry-run# Minimal non-interactive commit
git-cz --non-interactive --type=feat --subject="add new feature"
# Complete non-interactive commit
git-cz --non-interactive \
--type=feat \
--scope=auth \
--subject="implement OAuth integration" \
--body="Added Google and GitHub OAuth providers with token refresh" \
--breaking="OAuth configuration format changed" \
--issues="#123 #124"
# Non-interactive with git options
git-cz --non-interactive --type=fix --subject="fix critical bug" --amend# For use in prepare-commit-msg hooks
git-cz --hookThis mode writes the commit message to .git/COMMIT_EDITMSG and exits without executing git commit, allowing git hooks to process the message.
# Use custom subject formatting
git-cz --format="{type}{scope}: {subject} {emoji}"The CLI includes several validation checks:
--allow-empty, -a, or --amend is used){
"scripts": {
"commit": "git-cz",
"commit:auto": "git-cz --non-interactive --type=chore --subject=automated commit"
}
}# .git/hooks/prepare-commit-msg
#!/bin/sh
exec < /dev/tty && git-cz --hook || true# Automated commits in CI
git add .
git-cz --non-interactive \
--type=ci \
--subject="update build artifacts" \
--body="Automated commit from CI pipeline"