Convert Figma logo to code with AI

commitizen-tools logocommitizen

Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:

2,918
290
2,918
136

Top Related Projects

Generate changelogs and release notes from a project's commit messages and metadata.

33,714

Git hooks made easy 🐶 woof!

:package::rocket: Fully automated version management and package publishing

35,928

Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.

17,143

The commitizen command line utility. #BlackLivesMatter

CLI tool for Angular

Quick Overview

Commitizen is a command-line tool that helps developers write better commit messages by providing a guided, structured commit message format. It integrates with various version control systems, including Git, and can be customized to fit a project's specific needs.

Pros

  • Consistent Commit Messages: Commitizen enforces a consistent commit message format, making it easier to understand the changes in a project's history.
  • Guided Commit Process: The tool prompts the user with a series of questions, guiding them through the commit message creation process and ensuring that all necessary information is included.
  • Customizable Commit Types: Commitizen allows developers to define their own commit types, scopes, and other metadata, making it adaptable to different project workflows.
  • Integration with Version Control: Commitizen seamlessly integrates with Git and other version control systems, providing a streamlined commit experience.

Cons

  • Learning Curve: Some developers may find the initial setup and configuration of Commitizen to be a bit complex, especially if they're not familiar with the concept of structured commit messages.
  • Potential Overhead: The additional steps required to use Commitizen may slow down the commit process, which could be a concern for developers who prefer a more lightweight approach.
  • Adoption Challenges: Convincing an entire team or organization to adopt Commitizen can be challenging, as it requires a cultural shift in how commit messages are written.
  • Potential Compatibility Issues: Commitizen may not work seamlessly with all version control systems or project setups, which could limit its usefulness in certain environments.

Getting Started

To get started with Commitizen, follow these steps:

  1. Install Commitizen using npm or your preferred package manager:
npm install -g commitizen
  1. Initialize Commitizen in your project:
cd your-project-directory
commitizen init cz-conventional-changelog --save-dev --save-exact

This will install the cz-conventional-changelog adapter and configure your project to use Commitizen.

  1. Use Commitizen to create your commit messages:
git add .
git cz

This will launch the Commitizen prompt, guiding you through the process of creating a structured commit message.

  1. (Optional) Customize Commitizen by modifying the commitizen section in your package.json file or by creating a .czrc file in your project's root directory.

Competitor Comparisons

Generate changelogs and release notes from a project's commit messages and metadata.

Pros of conventional-changelog

  • More established project with a larger community and ecosystem
  • Offers a wider range of tools and integrations for changelog generation
  • Provides more flexibility in configuration and customization options

Cons of conventional-changelog

  • Steeper learning curve due to its extensive feature set
  • Requires more setup and configuration for optimal use
  • Can be overwhelming for smaller projects or teams new to conventional commits

Code Comparison

conventional-changelog:

const conventionalChangelog = require('conventional-changelog');

conventionalChangelog({
  preset: 'angular',
  releaseCount: 0
})
  .pipe(process.stdout);

commitizen:

from commitizen import git
from commitizen.cz.conventional_commits import ConventionalCommitsCz

cz = ConventionalCommitsCz(git.Git())
commit_message = cz.questions()
git.commit(commit_message)

The code snippets demonstrate the basic usage of each tool. conventional-changelog focuses on generating changelogs from commit history, while commitizen provides a command-line interface for creating conventional commits.

Both projects aim to improve commit message consistency and automate changelog generation, but they approach the task differently. conventional-changelog offers more advanced features for changelog generation, while commitizen focuses on simplifying the commit process itself.

33,714

Git hooks made easy 🐶 woof!

Pros of husky

  • Easier to set up and configure, with minimal changes to package.json
  • Supports a wider range of Git hooks, not just commit-related ones
  • Can run any script or command, not limited to commit message formatting

Cons of husky

  • Focuses solely on Git hooks, lacking built-in commit message formatting
  • Requires additional tools or scripts for commit message standardization
  • Less opinionated, which may lead to inconsistent commit practices across teams

Code Comparison

husky configuration in package.json:

{
  "husky": {
    "hooks": {
      "pre-commit": "npm test",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}

commitizen configuration in package.json:

{
  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog"
    }
  }
}

While husky provides a flexible framework for Git hooks, commitizen offers a more specialized solution for standardizing commit messages. husky excels in its versatility and ease of setup, but requires additional tools for commit message formatting. commitizen, on the other hand, provides a comprehensive solution for commit message standardization out of the box, but is more limited in scope compared to husky's broader Git hook capabilities.

:package::rocket: Fully automated version management and package publishing

Pros of semantic-release

  • Fully automated version management and package publishing
  • Supports multiple language ecosystems (Node.js, Python, Ruby, etc.)
  • Integrates well with CI/CD pipelines for seamless releases

Cons of semantic-release

  • Steeper learning curve due to more complex configuration
  • Requires careful setup to avoid unintended releases
  • Less flexibility in commit message format customization

Code Comparison

semantic-release configuration:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/npm",
    "@semantic-release/github"
  ]
}

Commitizen configuration:

commitizen:
  name: cz_conventional_commits
  version: 2.18.0
  tag_format: $version

Both tools aim to standardize commit messages and automate versioning, but they differ in approach and complexity. semantic-release focuses on fully automated releases, while Commitizen provides a more interactive commit message creation process. semantic-release is better suited for projects with established CI/CD pipelines, while Commitizen offers a more user-friendly experience for developers new to conventional commits. The choice between the two depends on project requirements, team preferences, and the desired level of automation in the release process.

35,928

Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.

Pros of Lerna

  • Designed for managing JavaScript projects with multiple packages
  • Optimizes the workflow for large-scale monorepo projects
  • Provides powerful tools for versioning and publishing packages

Cons of Lerna

  • Primarily focused on JavaScript/Node.js ecosystems
  • Can be complex to set up and configure for smaller projects
  • Less emphasis on standardizing commit messages

Code Comparison

Commitizen:

from commitizen import git
from commitizen.cz.conventional_commits import ConventionalCommitsCz

cz = ConventionalCommitsCz()
commit_message = cz.questions()
git.commit(commit_message)

Lerna:

{
  "version": "independent",
  "npmClient": "npm",
  "command": {
    "publish": {
      "ignoreChanges": ["ignored-file", "*.md"],
      "message": "chore(release): publish"
    }
  }
}

Commitizen focuses on standardizing commit messages and automating versioning based on those messages. It's language-agnostic and can be used in various project types. Lerna, on the other hand, is specifically designed for managing JavaScript monorepos, offering tools for versioning and publishing multiple packages within a single repository. While both tools aim to improve project management and versioning, they serve different primary purposes and are often used in different contexts.

17,143

The commitizen command line utility. #BlackLivesMatter

Pros of cz-cli

  • More established project with a larger community and ecosystem
  • Supports multiple languages and frameworks out of the box
  • Offers a wider range of customization options for commit message formats

Cons of cz-cli

  • Requires Node.js as a dependency, which may not be ideal for non-JavaScript projects
  • Configuration can be more complex, especially for advanced use cases
  • Less focus on enforcing commit message standards across a team

Code Comparison

cz-cli:

module.exports = {
  types: [
    { value: 'feat', name: 'feat:     A new feature' },
    { value: 'fix', name: 'fix:      A bug fix' },
    // ... more types
  ],
  // ... other configuration options
};

commitizen:

from commitizen import defaults

class CustomCz(defaults.DefaultCz):
    def questions(self):
        questions = super().questions()
        questions[0]["choices"] = [
            {"value": "feat", "name": "feat: A new feature"},
            {"value": "fix", "name": "fix: A bug fix"},
            # ... more types
        ]
        return questions

Both tools aim to standardize commit messages, but cz-cli is more JavaScript-centric, while commitizen is Python-based and offers a simpler configuration for Python projects. cz-cli provides more out-of-the-box options, while commitizen focuses on ease of use and integration with Python ecosystems.

CLI tool for Angular

Pros of Angular CLI

  • Comprehensive toolset for Angular development, including project scaffolding, testing, and deployment
  • Integrated with Angular ecosystem, providing seamless updates and compatibility
  • Extensive documentation and large community support

Cons of Angular CLI

  • Larger scope and complexity, potentially overwhelming for simple projects
  • Primarily focused on Angular development, less versatile for other frameworks or languages
  • Steeper learning curve for developers new to Angular ecosystem

Code Comparison

Angular CLI (generating a new component):

ng generate component my-component

Commitizen (making a commit):

cz commit

Key Differences

  • Purpose: Angular CLI is a comprehensive development tool for Angular projects, while Commitizen focuses on standardizing commit messages
  • Scope: Angular CLI covers various aspects of Angular development, whereas Commitizen is specifically for commit message formatting
  • Usage: Angular CLI is used throughout the development process, while Commitizen is primarily used during the commit stage

Use Cases

  • Angular CLI: Best for full-scale Angular projects requiring a complete development environment
  • Commitizen: Ideal for any project (regardless of framework or language) that wants to enforce consistent commit message formatting

Both tools serve different purposes and can be used together in an Angular project to enhance both development workflow and commit message consistency.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

GitHub Workflow Status Conventional Commits PyPI Package latest release PyPI Package download count (per month) Supported versions Conda Version homebrew Codecov pre-commit

Using Commitizen cli


Commitizen Documentation Site


About

Commitizen is a powerful release management tool that helps teams maintain consistent and meaningful commit messages while automating version management.

What Commitizen Does

By enforcing standardized commit conventions (defaulting to Conventional Commits), Commitizen helps teams:

  • Write clear, structured commit messages
  • Automatically manage version numbers using semantic versioning
  • Generate and maintain changelogs
  • Streamline the release process

Key Benefits

With just a simple cz bump command, Commitizen handles:

  1. Version Management: Automatically bumps version numbers and updates version files based on your commit history
  2. Changelog Generation: Creates and updates changelogs following the Keep a changelog format
  3. Commit Standardization: Enforces consistent commit message formats across your team

This standardization makes your commit history more readable and meaningful, while the automation reduces manual work and potential errors in the release process.

Features

Getting Started

Requirements

Before installing Commitizen, ensure you have:

Installation

Global Installation (Recommended)

The recommended way to install Commitizen is using pipx or uv, which ensures a clean, isolated installation: Using pipx:

# Install Commitizen
pipx install commitizen

# Keep it updated
pipx upgrade commitizen

Using uv:

# Install commitizen
uv tool install commitizen

# Keep it updated
uv tool upgrade commitizen

(For macOS users) Using Homebrew:

brew install commitizen

Project-Specific Installation

You can add Commitizen to your Python project using any of these package managers:

Using pip:

pip install -U commitizen

Using conda:

conda install -c conda-forge commitizen

Using Poetry:

# For Poetry >= 1.2.0
poetry add commitizen --group dev

# For Poetry < 1.2.0
poetry add commitizen --dev

Using uv:

uv add commitizen

Using pdm:

pdm add -d commitizen

Basic Commands

Initialize Commitizen

To get started, you'll need to set up your configuration. You have two options:

  1. Use the interactive setup:
cz init
  1. Manually create a configuration file (.cz.toml or cz.toml):
[tool.commitizen]
version = "0.1.0"
update_changelog_on_bump = true

Create Commits

Create standardized commits using:

cz commit
# or use the shortcut
cz c

To sign off your commits:

cz commit -- --signoff
# or use the shortcut
cz commit -- -s

For more commit options, run cz commit --help.

Version Management

The most common command you'll use is:

cz bump

This command:

  • Bumps your project's version
  • Creates a git tag
  • Updates the changelog (if update_changelog_on_bump is enabled)
  • Updates version files

You can customize:

For all available options, see the bump command documentation.

Advanced Usage

Get Project Version

# Get your project's version (instead of Commitizen's version)
cz version -p
# Preview changelog changes
cz changelog --dry-run "$(cz version -p)"

This command is particularly useful for automation scripts and CI/CD pipelines.

For example, you can use the output of the command cz changelog --dry-run "$(cz version -p)" to notify your team about a new release in Slack.

Pre-commit Integration

Commitizen can automatically validate your commit messages using pre-commit hooks.

  1. Add to your .pre-commit-config.yaml:
---
repos:
  - repo: https://github.com/commitizen-tools/commitizen
    rev: master  # Replace with latest tag
    hooks:
      - id: commitizen
      - id: commitizen-branch
        stages: [pre-push]
  1. Install the hooks:
pre-commit install --hook-type commit-msg --hook-type pre-push
HookRecommended Stage
commitizencommit-msg
commitizen-branchpre-push

Note: Replace master with the latest tag to avoid warnings. You can automatically update this with:

pre-commit autoupdate

For more details about commit validation, see the check command documentation.

Help & Reference

Command Line Interface

Commitizen provides a comprehensive CLI with various commands. Here's the complete reference:

cz --help

Quick Reference

CommandDescriptionAlias
cz initInitialize Commitizen configuration-
cz commitCreate a new commitcz c
cz bumpBump version and update changelog-
cz changelogGenerate changelogcz ch
cz checkValidate commit messages-
cz versionShow version information-

Additional Resources

Getting Help

For each command, you can get detailed help by adding --help:

cz commit --help
cz bump --help
cz changelog --help

For more details, visit our documentation site.

Setting up bash completion

Commitizen supports command-line completion through argcomplete, which is automatically installed as a dependency. This feature provides intelligent auto-completion for all Commitizen commands and options.

Supported Shells

  • Bash: Full support
  • Zsh: Limited support
  • Fish: Limited support
  • Tcsh: Limited support

Installation Methods

Global Installation (Recommended)

If you installed Commitizen globally (e.g., using pipx or brew), you can enable global completion:

# Enable global completion for all Python applications
sudo activate-global-python-argcomplete

User-Specific Installation

For a user-specific installation that persists across sessions:

# Add to your shell's startup file (e.g., ~/.bashrc, ~/.zshrc)
register-python-argcomplete cz >> ~/.bashrc

Temporary Installation

For one-time activation in your current shell session:

# Activate completion for current session only
eval "$(register-python-argcomplete cz)"

Verification

After installation, you can verify the completion is working by:

  1. Opening a new terminal session
  2. Typing cz followed by a space and pressing TAB twice
  3. You should see a list of available commands

For more detailed information about argcomplete configuration and troubleshooting, visit the argcomplete documentation.

Sponsors

These are our cool sponsors!