Categorygithub.com/shipengqi/commitizen
modulepackage
1.3.0
Repository: https://github.com/shipengqi/commitizen.git
Documentation: pkg.go.dev

# README

commitizen

test Go Report Card release license

Command line utility to standardize git commit messages, golang version. Forked from commitizen-go.

Fixes some issues of commitizen-go and supports more new features.

demo

Features

  • Multi-template support
  • Support more options of git commit
  • Use bubbletea instead of survey (survey is no longer maintained).
  • Better unit tests.

Getting Started

Command line utility to standardize git commit messages.

Usage:
  commitizen

Available Commands:
  init        Install this tool to git-core as git-cz.
  version     Print the CLI version information.      
  help        Help about any command

Git Commit flags:
  -a, --all
                commit all changed files.
      --amend
                amend previous commit
      --author string
                override author for commit
      --date string
                override date for commit
  -q, --quiet
                suppress summary after successful commit
  -s, --signoff
                add a Signed-off-by trailer.
  -v, --verbose
                show diff in commit message template

Commitizen flags:
  -d, --default
                use the default template, '--default' has a higher priority than '--template'.
      --dry-run
                do not create a commit, but show the message and list of paths
                that are to be committed.
  -t, --template string
                template name to use when multiple templates exist.

Use "commitizen [command] --help" for more information about a command.

Commit with commitizen:

$ git cz

Installation

From the Binary Releases

Download the pre-compiled binaries from the releases page and copy them to the desired location.

Then install this tool to git-core as git-cz:

$ commitizen init

Go Install

You must have a working Go environment:

$ go install github.com/shipengqi/commitizen@latest
$ commitizen init

From Source

You must have a working Go environment:

$ git clone https://github.com/shipengqi/commitizen.git
$ cd commitizen
$ make && ./_output/$(GOOS)/$(GOARCH)/bin/commitizen init

Configuration

You can set configuration file that .git-czrc at repository root or home directory. The configuration file that located in repository root have a priority over the one in home directory. The format is the same as the following:

name: my-default
default: true  # (optional) If true, this template will be used as the default template, note that there can only be one default template       
items:
  - name: type
    desc: "Select the type of change that you're committing:"
    type: select
    options:
      - name: feat
        desc: "A new feature"
      - name: fix
        desc: "A bug fix"
      - name: docs
        desc: "Documentation only changes"
      - name: test
        desc: "Adding missing tests"
      - name: WIP
        desc: "Work in progress"
      - name: chore
        desc: "Changes to the build process or auxiliary tools\n            and libraries such as documentation generation"
      - name: style
        desc: "Changes that do not affect the meaning of the code\n            (white-space, formatting, missing semi-colons, etc)"
      - name: refactor
        desc: "A code change that neither fixes a bug nor adds a feature"
      - name: perf
        desc: "A code change that improves performance"
      - name: revert
        desc: "Revert to a commit"
  - name: scope
    desc: "Scope. Could be anything specifying place of the commit change:"
    type: input
  - name: subject
    desc: "Subject. Concise description of the changes. Imperative, lower case and no final dot:"
    type: input
    required: true  # (optional) If true, enable a validator that requires the control have a non-empty value.
  - name: body
    desc: "Body. Motivation for the change and contrast this with previous behavior:"
    type: textarea
  - name: footer
    desc: "Footer. Information about Breaking Changes and reference issues that this commit closes:"
    type: textarea
format: "{{.type}}{{with .scope}}({{.}}){{end}}: {{.subject}}{{with .body}}\n\n{{.}}{{end}}{{with .footer}}\n\n{{.}}{{end}}"`

Commit message format:

format: "{{.type}}{{with .scope}}({{.}}){{end}}: {{.subject}}{{with .body}}\n\n{{.}}{{end}}{{with .footer}}\n\n{{.}}{{end}}"

Multiple Templates

You can define multiple templates in the .git-czrc file, separated by ---

name: angular-template
items:
  - name: scope
    desc: "Scope. Could be anything specifying place of the commit change:"
    type: input
  # ...  
format: "{{.type}}{{with .scope}}({{.}}){{end}}: {{.subject}}{{with .body}}\n\n{{.}}{{end}}{{with .footer}}\n\n{{.}}{{end}}"`

---

name: my-template
items:
  - name: scope
    desc: "Scope. Could be anything specifying place of the commit change:"
    type: input
  # ...  
format: "{{.type}}{{with .scope}}({{.}}){{end}}: {{.subject}}{{with .body}}\n\n{{.}}{{end}}{{with .footer}}\n\n{{.}}{{end}}"`

multiple-templates

# Packages

No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author