Skip to content

Commit d3e4a84

Browse files
jtpavlockLee-W
authored andcommitted
Add cz check --rev-range to the docs
Expands on the different use cases for using `cz check` as well
1 parent ef5450d commit d3e4a84

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/check.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## About
22

33
This feature checks whether the commit message follows the given committing rules.
4-
You can use either of the following methods to enforce the check.
4+
5+
## Checking before the commit
6+
To automatically check a commit message prior to committing, you can use a [git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). There are two common methods for installing the hook:
57

68
### Method 1: Add git hook through [pre-commit](https://pre-commit.com/)
79

@@ -60,3 +62,10 @@ Each time you create a commit, automatically, this hook will analyze it.
6062
If the commit message is invalid, it'll be rejected.
6163

6264
The commit should follow the given committing rules; otherwise, it won't be accepted.
65+
66+
## Checking after the commit
67+
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`
68+
69+
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`.
70+
71+
For more info 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).

0 commit comments

Comments
 (0)