You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
29
29
30
+
You can also use `--default-range` to check all commits from the default branch up to HEAD. This is equivalent to using `--rev-range <default_branch>..HEAD`.
31
+
30
32
For more information on how git commit ranges work, you can check the [git documentation](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_commit_ranges).
31
33
32
34
### Commit Message
33
35
34
36
There are two ways you can provide your plain message and check it.
35
37
36
-
#### Method 1: use -m or --message
38
+
#### Method 1: use `-m` or `--message`
37
39
38
40
```bash
39
41
$ cz check --message MESSAGE
40
42
```
41
43
42
-
In this option, MESSAGE is the commit message to be checked.
44
+
In this option, `MESSAGE` is the commit message to be checked.
43
45
44
46
#### Method 2: use pipe to pipe it to `cz check`
45
47
46
48
```bash
47
49
$ echo MESSAGE | cz check
48
50
```
49
51
50
-
In this option, MESSAGE is piped to cz check and will be checked.
52
+
In this option, `MESSAGE` is piped to `cz check` and will be checked.
51
53
52
54
### Commit Message File
53
55
54
56
```bash
55
57
$ cz check --commit-msg-file COMMIT_MSG_FILE
56
58
```
57
59
58
-
In this option, COMMIT_MSG_FILE is the path of the temporary file that contains the commit message.
60
+
In this option, `COMMIT_MSG_FILE` is the path of the temporary file that contains the commit message.
59
61
This argument can be useful when cooperating with git hooks. Please check [Automatically check message before commit](../tutorials/auto_check.md) for more information about how to use this argument with git hooks.
Empty commit messages typically instruct Git to abort a commit, so you can pass `--allow-abort` to
68
-
permit them. Since `git commit` accepts an`--allow-empty-message` flag (primarily for wrapper scripts), you may wish to disallow such commits in CI. `--allow-abort` may be used in conjunction with any of the other options.
70
+
permit them. Since `git commit` accepts the`--allow-empty-message` flag (primarily for wrapper scripts), you may wish to disallow such commits in CI. `--allow-abort` may be used in conjunction with any of the other options.
69
71
70
72
### Allowed Prefixes
71
73
72
74
If the commit message starts with some specific prefixes, `cz check` returns `True` without checking the regex.
73
-
By default, the following prefixes are allowed: `Merge`, `Revert`, `Pull request`, `fixup!` and `squash!`.
@@ -83,5 +91,5 @@ For example, `cz check --message MESSAGE -l 3` would fail the check, since `MESS
83
91
By default, the limit is set to 0, which means no limit on the length.
84
92
85
93
**Note that the limit applies only to the first line of the message.**
86
-
Specifically, for `ConventionalCommitsCz` the length only counts from the type of change to the subject,
87
-
while the body and the footer are not counted.
94
+
95
+
Specifically, for `ConventionalCommitsCz` the length only counts from the type of change to the subject, while the body and the footer are not counted.
0 commit comments