This feature checks whether the commit message follows the given committing rules. And comment in git message will be ignored.
If you want to setup an automatic check before every git commit, please refer to Automatically check message before commit.
There are three arguments that you can use one of them to check commit message.
If you'd like to check a commit's message after it has already been created, then you can specify the range of commits to check with --rev-range REV_RANGE
.
$ cz check --rev-range REV_RANGE
For example, if you'd like to check all commits on a branch, you can use --rev-range master..HEAD
. Or, if you'd like to check all commits starting from when you first implemented commit message linting, you can use --rev-range <first_commit_sha>..HEAD
.
For more info on how git commit ranges work, you can check the git documentation.
There are two ways you can provide your plain message and check it.
$ cz check --message MESSAGE
In this option, MESSAGE is the commit message to be checked.
$ echo MESSAGE | cz check
In this option, MESSAGE is piped to cz check and would be checked.
$ cz check --commit-msg-file COMMIT_MSG_FILE
In this option, COMMIT_MSG_FILE is the path of the temporal file that contains the commit message. This argument can be useful when cooperating with git hook, please check Automatically check message before commit for more information about how to use this argument with git hook.