p:: Git
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.
Conventional commit messages as a global utility
Install commitizen
globally, if you have not already.
npm install -g commitizen
Install your preferred commitizen
adapter globally (for example cz-conventional-changelog
).
npm install -g cz-conventional-changelog
Create a .czrc
file in your home
directory, with path
referring to the preferred, globally-installed, commitizen
adapter
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
You are all set! Now cd
into any git
repository and use git cz
instead of git commit
, and you will find the commitizen
prompt.
Pro tip: You can use all the git commit
options
with git cz
. For example: git cz -a
.
git cz
[email protected], [email protected]
? Select the type of change that you're committing: (Use arrow keys)
❯ feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing tests or correcting existing tests
(Move up and down to reveal more choices)
If your repository is a Node.js project, making it Commitizen friendly is super easy.
If your repository is already Commitizen friendly, the local commitizen
adapter will be used, instead of globally installed one.
Making your repo Commitizen friendly
Initialize your project to use the cz-conventional-changelog adapter by typing:
commitizen init cz-conventional-changelog --save-dev --save-exact
Or if you are using Yarn:
commitizen init cz-conventional-changelog --yarn --dev --exact
If your repo is Commitizen friendly:
git cz