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
Empty commit messages indicate to Git that the commit should be aborted.
Displaying an error message when the commit is already being aborted
typically only creates confusion. Add --reject-abort argument to the
check command and reject_abort config variable, both defaulting to false.
One may wish to pass --reject-abort in CI to ensure that a commit
created with git commit --allow-empty-message (e.g., by a script)
doesn't slip through. When the commit message is empty, determine the
outcome based on the reject_abort setting alone, ignoring the pattern.
Copy file name to clipboardExpand all lines: docs/check.md
+14-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,11 @@ If you want to setup an automatic check before every git commit, please refer to
7
7
[Automatically check message before commit](auto_check.md).
8
8
9
9
## Usage
10
-
There are three arguments that you can use one of them to check commit message.
10
+
There are three mutually exclusive ways to use `cz check`:
11
+
12
+
- with `--rev-range` to check a range of pre-existing commits
13
+
- with `--message` or by piping the message to it to check a given string
14
+
- or with `--commit-msg-file` to read the commit message from a file
11
15
12
16
### Git Rev Range
13
17
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`.
In this option, COMMIT_MSG_FILE is the path of the temporal file that contains the commit message.
48
52
This argument can be useful when cooperating with git hook, please check [Automatically check message before commit](auto_check.md) for more information about how to use this argument with git hook.
53
+
54
+
### Reject Abort
55
+
56
+
57
+
```bash
58
+
cz check --message MESSAGE --reject-abort
59
+
```
60
+
61
+
Empty commit messages typically instruct Git to abort a commit, so by default they are not considered invalid. However, `git commit` accepts an `--allow-empty-message` flag (primarily for wrapper scripts), so you can use `--reject-abort` if you wish to disallow such commits (e.g., in CI). `--reject-abort` may be used in conjunction with any of the other options.
| `changelog_incremental` | `bool` | `false` | Update changelog with the missing versions. This is good if you don't want to replace previous versions in the file. Note: when doing `cz bump --changelog` this is automatically set to `true` |
136
137
| `changelog_start_rev` | `str` | `None` | Start from a given git rev to generate the changelog |
0 commit comments