Skip to content

Commit de5cb48

Browse files
committed
docs: add auto check and format files
1 parent 2d07abe commit de5cb48

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

docs/check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Check
22

33
## About
4+
45
This feature checks whether the commit message follows the given committing rules. And comment in git message will be ignored.
56

67
If you want to setup an automatic check before every git commit, please refer to
78
[Automatically check message before commit](auto_check.md).
89

910
## Usage
11+
1012
There are three mutually exclusive ways to use `cz check`:
1113

1214
- with `--rev-range` to check a range of pre-existing commits
1315
- with `--message` or by piping the message to it to check a given string
1416
- or with `--commit-msg-file` to read the commit message from a file
1517

1618
### Git Rev Range
19+
1720
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`.
1821

1922
```bash
@@ -25,7 +28,9 @@ For example, if you'd like to check all commits on a branch, you can use `--rev-
2528
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).
2629

2730
### Commit Message
31+
2832
There are two ways you can provide your plain message and check it.
33+
2934
#### Method 1: use -m or --message
3035

3136
```bash

docs/auto_check.md renamed to docs/tutorials/auto_check.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Automatically check message before commit
22

33
## About
4+
45
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).
56

67
## How to
8+
79
There are two common methods for installing the hook:
10+
811
### Method 1: Add git hook through [pre-commit](https://pre-commit.com/)
912

10-
* Step 1: Install [pre-commit](https://pre-commit.com/)
13+
- Step 1: Install [pre-commit](https://pre-commit.com/)
1114

1215
```sh
1316
python -m pip install pre-commit
1417
```
1518

16-
* Step 2: Create `.pre-commit-config.yaml` at your root directory with the following content
19+
- Step 2: Create `.pre-commit-config.yaml` at your root directory with the following content
1720

1821
```yaml
1922
---
@@ -24,13 +27,14 @@ repos:
2427
- id: commitizen
2528
```
2629
27-
* Step 3: Install the configuration into git hook through `pre-commit`
30+
- Step 3: Install the configuration into git hook through `pre-commit`
2831

2932
```bash
3033
pre-commit install --hook-type commit-msg
3134
```
3235

3336
### Method 2: Manually add git hook
37+
3438
The command might be included inside of a Git hook (inside of `.git/hooks/` at the root of the project).
3539

3640
The selected hook might be the file called commit-msg.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ nav:
2020
- Customization: 'customization.md'
2121
- Tutorials:
2222
- Writing commits: 'tutorials/writing_commits.md'
23+
- Auto check commits: 'tutorials/auto_check.md'
2324
- GitLab CI: 'tutorials/gitlab_ci.md'
2425
- Github Actions: 'tutorials/github_actions.md'
2526
- Jenkins pipeline: 'tutorials/jenkins_pipeline.md'

0 commit comments

Comments
 (0)