rokroskar / commitizen

Create commiting rules for projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Python 3 command line utility to standardize commit messages
Conventional Commits PyPI Package latest release Supported versions

Example running commitizen


Beta is available and has support only for python 3


This is an interactive tool to commit based on some rules (like conventional commits).

It comes with some defaults commit styles, like conventional commits and jira and it's easily extendable.

It's useful for teams, because it is possible to standardize the commiting style.


pip install commitizen

For beta

sudo pip3 install -U commitizen --pre


This client tool prompts the user with information about the commit.

Based on conventional commits

This is an example of how the git messages history would look like:

BREAKING CHANGE: command send has been removed
fix: minor typos in code
feat: new command update
docs: improved commitizens tab in readme
feat(cz): jira smart commits
refactor(cli): renamed all to ls command
feat: info command for angular
docs(README): added badges
docs(README): added about, installation, creating, etc
feat(config): new loads from ~/.cz and working project .cz .cz.cfg and setup.cfg


These are the available commiting styles by default:

The installed ones can be checked with:

cz ls


Run in your terminal

cz commit

or the shortcut

cz c


usage: cz [-h] [--debug] [-n NAME] [--version]
        {ls,commit,c,example,info,schema} ...

Commitizen is a cli tool to generate conventional commits.
For more information about the topic go to

optional arguments:
-h, --help            show this help message and exit
--debug               use debug mode
-n NAME, --name NAME  use the given commitizen
--version             get the version of the installed commitizen

    ls                  show available commitizens
    commit (c)          create new commit
    example             show commit example
    info                show information about the cz
    schema              show commit schema


You can create in your project folder a file called .cz, .cz.cfg or in your setup.cfg or if you want to configure the global default in your user's home folder a .cz file with the following information:

name = cz_conventional_commits

Creating a commiter

Create a file starting with cz_ for example This prefix is used to detect the plugin. Same method flask uses

Inherit from BaseCommitizen and you must define questions and message. The others are optionals.

from commitizen import BaseCommitizen

class JiraCz(BaseCommitizen):

    def questions(self):
        """Questions regarding the commit message.

        Must have 'whaaaaat' format.
        More info:

        :rtype: list
        questions = [
                'type': 'input',
                'name': 'title',
                'message': 'Commit title'
                'type': 'input',
                'name': 'issue',
                'message': 'Jira Issue number:'
        return questions

    def message(self, answers):
        """Generate the message with the given answers.

        :type answers: dict
        :rtype: string
        return '{0} (#{1})'.format(answers['title'], answers['issue'])

    def example(self):
        """Provide an example to help understand the style (OPTIONAL)
        Used by cz example.

        :rtype: string
        return 'Problem with user (#321)'

    def schema(self):
        """Show the schema used (OPTIONAL)

        :rtype: string
        return '<title> (<issue>)'

    def info(self):
        """Explanation of the commit rules. (OPTIONAL)
        :rtype: string
        return 'We use this because is useful'

discover_this = JiraCz  # used by the plugin system

The next file required is modified from flask version

from distutils.core import setup

    long_description='this is a long description',

So at the end we would have


And that's it, you can install it without uploading to pypi by simply doing pip install . If you feel like it should be part of the repo, create a PR.

Python 2 support

There's no longer support for python 2. Nor planned suppport.

Feel free to create a PR.


  1. Clone the repo.
  2. Add your modifications
  3. Create a virtualenv
  4. Run pytest -s --cov-report term-missing --cov=commitizen tests/
ezoic increase your site revenue


Create commiting rules for projects

License:MIT License


Language:Python 100.0%