commitizen

The commitizen command line utility.

Integration with husky

Install the Commitizen CLI tools:

npm install -g commitizen

Commitizen for multi-repo projects:

npm install --save-dev commitizen

Initialize the conventional changelog adapter:

npx commitizen init cz-conventional-changelog --save-dev --save-exact

Alternatively, if you are using npm 5.2+ you can use npx instead of installing globally:

npx cz

Add a hook:

npx husky add .husky/prepare-commit-msg "exec < /dev/tty && node_modules/.bin/cz --hook || true"

Add the following configuration to the project's package.json file:

{
    "husky": {
        "hooks": {
            "prepare-commit-msg": "exec < /dev/tty && npx cz --hook || true"
        }
    }
}

Integration with pre-commit

Create committing rules for projects 🚀 auto bump versions ⬆️ and auto changelog generation.

pip install -U commitizen
poetry add commitizen --dev
repos:
  - repo: https://github.com/commitizen-tools/commitizen
    rev: master
    hooks:
      - id: commitizen
        stages: [commit-msg]

After the configuration is added, you'll need to run:

pre-commit install --hook-type commit-msg