1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# Commandline config
Gitlint behavior can be changed by various commandline flags and environment variables.
These fall in 2 categories:
1. [**General options**](general_options.md): configure gitlint's overall behavior
2. **Rule specific options**: configure how specific rules behave
To set `general` options ([full reference](general_options.md)) via the CLI, there's a number of convenience flags and environment
variables available. Example:
=== ":octicons-terminal-16: CLI"
```sh
# Mute all output
gitlint --silent
# Lint a specific commit
gitlint --commit abc123
```
=== ":material-application-variable-outline: Env var"
```sh
# Mute all output
GITLINT_SILENT=1 gitlint
# Lint a specific commit
GITLINT_COMMIT=abc123 gitlint
```
Alternatively, you can also use one or more `-c` flags like so:
```sh
gitlint -c general.silent=true -c title-max-length.line-length=80
```
The benefit of the `-c` flag is that it can set both `general` options as well as `rule` options.
The generic config flag format is `-c <rule>.<option>=<value>` and supports all the same rules and options which
you can also use in a [`.gitlint` config file](gitlint_file.md).
# All commands and options
```no-highlight
$ gitlint --help
Usage: gitlint [OPTIONS] COMMAND [ARGS]...
Git lint tool, checks your git commit messages for styling issues
Documentation: http://jorisroovers.github.io/gitlint
Options:
--target DIRECTORY Path of the target git repository. [default:
current working directory]
-C, --config FILE Config file location [default: .gitlint]
-c TEXT Config flags in format <rule>.<option>=<value>
(e.g.: -c T1.line-length=80). Flag can be
used multiple times to set multiple config values.
--commit TEXT Hash (SHA) of specific commit to lint.
--commits TEXT The range of commits (refspec or comma-separated
hashes) to lint. [default: HEAD]
-e, --extra-path PATH Path to a directory or python module with extra
user-defined rules
--ignore TEXT Ignore rules (comma-separated by id or name).
--contrib TEXT Contrib rules to enable (comma-separated by id or
name).
--msg-filename FILENAME Path to a file containing a commit-msg.
--ignore-stdin Ignore any stdin data. Useful for running in CI
server.
--staged Attempt smart guesses about meta info (like
author name, email, branch, changed files, etc)
for staged commits.
--fail-without-commits Hard fail when the target commit range is empty.
-v, --verbose Verbosity, more v's for more verbose output
(e.g.: -v, -vv, -vvv). [default: -vvv]
-s, --silent Silent mode (no output).
Takes precedence over -v, -vv, -vvv.
-d, --debug Enable debugging output.
--version Show the version and exit.
--help Show this message and exit.
Commands:
generate-config Generates a sample gitlint config file.
install-hook Install gitlint as a git commit-msg hook.
lint Lints a git repository [default command]
run-hook Runs the gitlint commit-msg hook.
uninstall-hook Uninstall gitlint commit-msg hook.
When no COMMAND is specified, gitlint defaults to 'gitlint lint'.
```
|