k3ii / git-cz

A simple commitizen written in rust
Other
12 stars 2 forks source link
cli commitizen git rust

git-cz

git-cz is a simple commitizen tool written in rust.

git-cz helps you create conventional commits with ease. It prompts you to select the type of commit, enter a scope (optional), and provide a summary and detailed description.

demo

Features

Installation

cargo install git-commitizen

[!NOTE] Although the package is called git-commitizen on crates.io, the installed binary is named git-cz:

Check releases for pre-built binaries or compiled binary for your platform.

Conventional Commits

The Conventional Commits specification is a convention for writing consistent commit messages. It helps in automating the release process, generating changelogs, and making it easier to understand the history of a project.

Format

A conventional commit message has the following format:

<type>(<scope>): <summary>

<body>

<footer>

Benefits

How Git Picks Up git-cz

Git has a feature called "Git command aliases" that allows it to treat any executable file named git-<command> in your PATH as a Git subcommand. This is how git-cz works:

  1. When you run git cz, Git looks for an executable file named git-cz in the directories listed in your PATH.
  2. If it finds such a file (which is our script), Git executes it as if it were a built-in Git command.
  3. This mechanism allows you to create custom Git commands without modifying Git itself.

By naming our script git-cz and placing it in a directory in the PATH, we're effectively creating a new Git command cz that can be invoked as git cz. This approach is flexible and allows for easy installation and use across different projects without requiring project-specific configuration.

See also

Contributing

Feel free to improve the script to add your own commit types or make any other enhancements you think are useful. Contributions are welcome!

If you would like to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make your changes.
  4. Submit a pull request.

Your contributions can help make this tool even more useful for everyone. Thank you for considering contributing!