commitizen /cz-cli
The commitizen command line utility. #BlackLivesMatter
★ 17,505⑂ 564👁 78⑃ 656● 367▤ 76
+1
Daily
17,505
stars
564
forks
78
watchers
656
prs
367
issues
76
releases
README
Commitizen for contributors
When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time. No more waiting until later for a git commit hook to run and reject your commit (though that can still be helpful). No more digging through CONTRIBUTING.md to find what the preferred format is. Get instant feedback on your commit message formatting and be prompted for required fields.
Installing the command line tool
Commitizen is currently tested against Node.js 12, 14, & 16, although it may work in
older versions of Node.js. You should also have npm 6 or greater.
Installation is as simple as running the following command (if you see EACCES error, reading fixing npm permissions may help):
sh
npm install -g commitizen
Using the command line tool
If your repo is Commitizen friendly:
Simply use git cz or just cz instead of git commit when committing. You can also use git-cz, which is an alias for cz.
_Alternatively_, if you are using npm 5.2+ you can use npx instead of installing globally:
sh
npx cz
or as an npm script:
json
...
"scripts": {
"commit": "cz"
}
When you're working in a Commitizen-friendly repository, you'll be prompted to fill in any required fields, and your commit messages will be formatted according to the standards defined by project maintainers.
If your repo is NOT Commitizen friendly:
If you're not working in a Commitizen-friendly repository, then git cz will work just the same as git commit, but npx cz will use the streamich/git-cz adapter. To fix this, you need to first make your repo Commitizen friendly
Making your repo Commitizen friendly
For this example, we'll be setting up our repo to use AngularJS's commit message convention, also known as conventional-changelog.
First, install the Commitizen CLI tools:
sh
npm install commitizen -g
Next, initialize your project to use the cz-conventional-changelog adapter by typing:
sh
npm
commitizen init cz-conventional-changelog --save-dev --save-exact
yarn
commitizen init cz-conventional-changelog --yarn --dev --exact
pnpm
commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact
Note that if you want to force install over the top of an old adapter, you can apply the --force argument. For more information on this, just run commitizen help.
The above command does three things for you:
1. Installs the cz-conventional-changelog adapter npm module
2. Saves it to package.json's dependencies or devDependencies
3. Adds the config.commitizen key to the root of your package.json file as shown here:
json
...
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
Alternatively, Commitizen configs may be added to a .czrc file:
json
{
"path": "cz-conventional-changelog"
}
This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo.
commitizen.path is resolved via require.resolve and supports:
Top issues
#627How to husky prepare-commit-msg on windows?25 comments · 2019-05-02#558git cz just opens the local editor25 comments · 2018-08-31#604Run pre-commit hook before the prompt22 comments · 2019-01-15#709Windows Issues from husky hooks / or just regular git hooks19 comments · 2020-02-26#934Wizard exits into vim/COMMIT_EDITMSG14 comments · 2022-05-10#801Add `pre-commit` hook that will run Commitizen on `git commit`14 comments · 2021-01-03#2052.8.0 doesn't make any commits14 comments · 2016-04-21#933error: pathspec 'commit' did not match any file(s) known to git git exited with error code 113 comments · 2022-05-08
Latest release
v4.3.2 v4.3.2 2026-06-124.3.2 (2026-06-12) chore(deps): bump semantic-release to 25 for npm trusted publishing (1029) (6eb168c), closes 1029 ci(release): bump actions/checkout and actions/setup-node to v4 (1024) (f5702c4), closes 1024 ci(release): use npm trusted publishing via OIDC (1028) (096ed52), closes 1028 chore(deps) Update all non-major dependencies (1026) (4e98218), closes 1026 chore(deps) Update dependency lodash to v4.18.1 [SECURITY] (1010) (11be6a1), closes 1010 fix(ci): fix pipelines and update matrices to node 18/20/22 (1023) (48e4b8b), closes 1023 docs: update README.md to add contributors (985