Skip to content

Commit 1c36d7d

Browse files
asottilejorisroovers
authored andcommitted
Add pre-commit metadata (#62)
This enables out-of-the-box usage with https://pre-commit.com as a commit-msg hook.
1 parent 941b76a commit 1c36d7d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.pre-commit-hooks.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- id: gitlint
2+
name: gitlint
3+
language: python
4+
entry: gitlint --msg-filename
5+
stages: [commit-msg]

docs/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ gitlint uninstall-hook
135135
file in your local repository, gitlint will refuse to install the ```commit-msg``` hook. Gitlint will also only
136136
uninstall unmodified commit-msg hooks that were installed by gitlint.
137137

138+
## Using gitlint through [pre-commit](https://pre-commit.com)
139+
140+
`gitlint` can be configured as a plugin for the `pre-commit` git hooks
141+
framework. Simply add the configuration to your `.pre-commit-config.yaml`:
142+
143+
```yaml
144+
- repo: https://github.com/jorisroovers/gitlint
145+
rev: # Fill in a tag / sha here
146+
hooks:
147+
- id: gitlint
148+
```
149+
150+
138151
## Using gitlint in a CI environment ##
139152
By default, when just running ```gitlint``` without additional parameters, gitlint lint the last commit in the current
140153
git repository.

0 commit comments

Comments
 (0)