Skip to content

Latest commit

 

History

History
97 lines (70 loc) · 2.26 KB

File metadata and controls

97 lines (70 loc) · 2.26 KB

Commitlint CLI

Installation

pip install commitlint

Usage

commitlint [-h] [-V] [--file FILE] [--hash HASH] [--from-hash FROM_HASH] [--to-hash TO_HASH]
           [--skip-detail] [--hide-input]
           [-q | -v]
           [--max-header-length MAX_HEADER_LENGTH]
           [commit_message]

Check if a commit message follows the Conventional Commits format.

Positional arguments:
  commit_message                The commit message to be checked.

Options:
  -h, --help                    Show this help message and exit.
  --file FILE                   Path to a file containing the commit message.
  -V, --version                 Show the program's version number and exit.
  --hash HASH                   Commit hash.
  --from-hash FROM_HASH         Commit hash to start checking from.
  --to-hash TO_HASH             Commit hash to check up to.
  --skip-detail                 Skip detailed error messages.
  --hide-input                  Hide input from stdout.
  -q, --quiet                   Suppress stdout and stderr.
  -v, --verbose                 Enable verbose output.
  --max-header-length LENGTH    Maximum header length to check.

Examples

Check a commit message directly:

$ commitlint "chore: my commit message"

Check a commit message from a file:

$ commitlint --file /foo/bar/commit-message.txt

Note: When using the --file option, avoid commit messages that start with #, as this may cause unexpected behavior with commitlint.

Check the commit message of a specific hash:

$ commitlint --hash 9a8c08173

Check commit messages within a hash range:

$ commitlint --from-hash 00bf73fef7 --to-hash d6301f1eb0

Check a commit message while skipping detailed error messages:

$ commitlint --skip-detail "chore: my commit message"
# or
$ commitlint --skip-detail --hash 9a8c08173

Run commitlint in quiet mode:

$ commitlint --quiet "chore: my commit message"

Run commitlint in verbose mode:

$ commitlint --verbose "chore: my commit message"

Run commitlint with maximum header length check:

$ commitlint --max-header-length 72 "chore: my commit message"

Check the version:

$ commitlint --version
# or
$ commitlint -V