commitizen
Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:
Top Related Projects
Generate changelogs and release notes from a project's commit messages and metadata.
Git hooks made easy 🐶 woof!
:package::rocket: Fully automated version management and package publishing
:dragon: Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
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:
- Install Commitizen using npm or your preferred package manager:
npm install -g commitizen
- 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.
- 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.
- (Optional) Customize Commitizen by modifying the
commitizen
section in yourpackage.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.
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.
:dragon: 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.
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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Documentation: https://commitizen-tools.github.io/commitizen/
About
Commitizen is release management tool designed for teams.
Commitizen assumes your team uses a standard way of committing rules and from that foundation, it can bump your project's version, create the changelog, and update files.
By default, commitizen uses conventional commits, but you can build your own set of rules, and publish them.
Using a standardized set of rules to write commits, makes commits easier to read, and enforces writing descriptive commits.
Features
- Command-line utility to create commits with your rules. Defaults: Conventional commits
- Bump version automatically using semantic versioning based on the commits. Read More
- Generate a changelog using Keep a changelog
- Update your project's version files automatically
- Display information about your commit rules (commands: schema, example, info)
- Create your own set of rules and publish them to pip. Read more on Customization
Requirements
Python 3.8+
Git 1.8.5.2+
Installation
Install commitizen in your system using pipx
(Recommended, https://pypa.github.io/pipx/installation/):
pipx ensurepath
pipx install commitizen
pipx upgrade commitizen
Install commitizen using pip
with --user
flag:
pip install --user -U commitizen
Python project
You can add it to your local project using one of these:
pip install -U commitizen
for Poetry >= 1.2.0:
poetry add commitizen --group dev
for Poetry < 1.2.0:
poetry add commitizen --dev
macOS
via homebrew:
brew install commitizen
Usage
Most of the time this is the only command you'll run:
cz bump
On top of that, you can use commitizen to assist you with the creation of commits:
cz commit
Read more in the section Getting Started.
Help
$ cz --help
usage: cz [-h] [--debug] [-n NAME] [-nr NO_RAISE] {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} ...
Commitizen is a cli tool to generate conventional commits.
For more information about the topic go to https://conventionalcommits.org/
optional arguments:
-h, --help show this help message and exit
--config the path of configuration file
--debug use debug mode
-n NAME, --name NAME use the given commitizen (default: cz_conventional_commits)
-nr NO_RAISE, --no-raise NO_RAISE
comma separated error codes that won't rise error, e.g: cz -nr 1,2,3 bump. See codes at https://commitizen-
tools.github.io/commitizen/exit_codes/
commands:
{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}
init init commitizen configuration
commit (c) create new commit
ls show available commitizens
example show commit example
info show information about the cz
schema show commit schema
bump bump semantic version based on the git log
changelog (ch) generate changelog (note that it will overwrite existing file)
check validates that a commit message matches the commitizen schema
version get the version of the installed commitizen or the current project (default: installed commitizen)
Setting up bash completion
When using bash as your shell (limited support for zsh, fish, and tcsh is available), Commitizen can use argcomplete for auto-completion. For this argcomplete needs to be enabled.
argcomplete is installed when you install Commitizen since it's a dependency.
If Commitizen is installed globally, global activation can be executed:
sudo activate-global-python-argcomplete
For permanent (but not global) Commitizen activation, use:
register-python-argcomplete cz >> ~/.bashrc
For one-time activation of argcomplete for Commitizen only, use:
eval "$(register-python-argcomplete cz)"
For further information on activation, please visit the argcomplete website.
Sponsors
These are our cool sponsors!
Top Related Projects
Generate changelogs and release notes from a project's commit messages and metadata.
Git hooks made easy 🐶 woof!
:package::rocket: Fully automated version management and package publishing
:dragon: Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
The commitizen command line utility. #BlackLivesMatter
CLI tool for Angular
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot