Skip to content

Commit 158a690

Browse files
authored
Merge pull request #35 from aj3sh/conventional-commit-doc
docs: add Conventional commit message info in README
2 parents 09d4189 + 840b680 commit 158a690

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

Diff for: README.md

+31-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,33 @@
88

99
commitlint is a tool designed to lint your commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/) standard for your pre-commit hook and GitHub Actions.
1010

11+
## Conventional Commits
12+
13+
A conventional commit message follows a specific format that includes a prefix indicating the type of change, an optional scope for context, and a concise description of the modification.
14+
This structure improves readability, facilitates automated changelog generation, and ensures a consistent commit history.
15+
16+
The commit message should follow this structure:
17+
18+
```
19+
<type>(<optional scope>): <description>
20+
21+
[Optional body]
22+
```
23+
24+
**Type:** Indicates the type of change, such as build, ci, docs, feat, fix, perf, refactor, style, test, chore, revert, or bump.
25+
E.g., `feat: add JSON parser`.
26+
27+
**Scope:** Additional contextual information.
28+
E.g., `feat(parser): add JSON parser`.
29+
30+
**Description:** Brief description of the commit.
31+
32+
**Body:** A detailed description of the commit.
33+
34+
For more details, please refer to the Conventional Commits specification at https://www.conventionalcommits.org/en/v1.0.0/
35+
36+
> NOTE: commitlint also checks the length of the commit header (**max 72 characters**). The commit header refers to the first line of the commit message (excluding the body).
37+
1138
## How to use
1239

1340
### For pre-commit
@@ -83,16 +110,16 @@ jobs:
83110
| 1 | **exit_code** | Integer | The exit code of the commitlint step. |
84111
| 2 | **status** | String | The outcome of the commitlint step. Possible values: 'success' or 'failure'. |
85112
86-
87113
## CLI (Command Line Interface)
88114
89-
### Installation
115+
### Installation
90116
91117
```shell
92118
pip install commitlint
93119
```
94120

95121
### Usage
122+
96123
```
97124
$ commitlint --help
98125
usage: commitlint [-h] [-V] [--file FILE] [--hash HASH] [--from-hash FROM_HASH] [--to-hash TO_HASH] [--skip-detail] [commit_message]
@@ -114,8 +141,9 @@ optional arguments:
114141
```
115142

116143
### Examples
144+
117145
Check commit message directly:
118-
146+
119147
```shell
120148
$ commitlint "chore: my commit message"
121149
```

0 commit comments

Comments
 (0)