3 unstable releases

0.7.2 Apr 6, 2021
0.4.4 Jan 23, 2021
0.4.3 Jan 19, 2021

#413 in Build Utils

Download history 49/week @ 2024-03-10 91/week @ 2024-03-17 38/week @ 2024-03-24 108/week @ 2024-03-31 51/week @ 2024-04-07 51/week @ 2024-04-14 43/week @ 2024-04-21 27/week @ 2024-04-28 24/week @ 2024-05-05 27/week @ 2024-05-12 4/week @ 2024-05-19 9/week @ 2024-05-26 9/week @ 2024-06-02 22/week @ 2024-06-09 20/week @ 2024-06-16 16/week @ 2024-06-23

67 downloads per month

MIT license

83KB
2K SLoC

Git-cz

git-cz is short for git-commitizen

GitHub Workflow Status Crates.io

A Conventional commit cli.

git-cz gives tools to work with Conventional Commits.

The tool is still in early development. It provides already the following commands:

  • git-cz changelog: Create a changelog file.
  • git-cz check: Checks if a range of commits is following the convention.
  • git-cz commit: Helps to make conventional commits.
  • git-cz version: Finds out the current or next version.

git-cz-screen-record.gif

Installation

build from sourceo

cargo install --git https://github.com/ttys3/git-cz.git

download pre-build binary

download and put git-cz to your PATH env

Git alias

recommand Git alias:


# use "git cc" for quick commit
git config --global alias.cc 'cz commit'

git config --global alias.ck 'cz check'

git config --global alias.cl 'cz changelog'

git config --global alias.cv 'cz version'

Docker usage

# build the git-cz image
docker build -t git-cz .
# run it on any codebase
docker run -v "$PWD:/tmp" --workdir /tmp --rm git-cz

Use it in .gitlab-ci.yml

If you've created an image and pushed it into your private registry

git-cz:check:
  stage: test
  image:
    name: 80x86/git-cz:latest
  script:
    - check

Tools

Changelog

A changelog can be generated using the conventional commits. It is inspired by conventional changelog. Configuration follows the conventional-changelog-config-spec

git-cz changelog > CHANGELOG.md

Check

Check a range of revisions for compliance.

It returns a non zero exit code if some commits are not conventional. This is useful in a pre-push hook.

git-cz check $remote_sha..$local_sha

Commit

Helps to make conventional commits. A scope, description, body, breaking change and issues will be prompted.

# commit a new feature and then run git commit with the interactive patch switch
git-cz commit --feat -- --patch

Version

When no options are given it will return the current version. When --bump is provided, the next version will be printed out. Conventional commits are used to calculate the next major, minor or patch. If needed one can provide --major, --minor or --patch to overrule the convention.

git-cz version --bump

It is useful to use it with release tools, such as cargo-release:

cargo release $(git-cz version --bump)

TODO

  • automatic notes for breaking changes
  • custom template folder
  • use a .versionrc file
  • limit to a range of versions
  • sort sections in changelog
  • issue references
  • better documentation
  • better error handling

Thanks

  • fuzzy finder powered by Skim

  • original code by convco

Ref

https://www.conventionalcommits.org/en/v1.0.0/

https://github.com/commitizen/conventional-commit-types/blob/master/index.json

https://github.com/commitizen/cz-cli

https://github.com/goreleaser/chglog

https://github.com/ahmadawais/Emoji-Log

Dependencies

~26–38MB
~695K SLoC