summaryrefslogtreecommitdiffstats
path: root/docs/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/index.md')
-rw-r--r--docs/index.md52
1 files changed, 29 insertions, 23 deletions
diff --git a/docs/index.md b/docs/index.md
index 5b371bf..98b72de 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -38,12 +38,11 @@ useful throughout the years.
# Pip is recommended to install the latest version
pip install gitlint
-# macOS
-brew install gitlint
-sudo port install gitlint # alternative using macports
-
-# Ubuntu
-apt-get install gitlint
+# Community maintained packages:
+brew install gitlint # Homebrew (macOS)
+sudo port install gitlint # Macports (macOS)
+apt-get install gitlint # Ubuntu
+# Other package managers, see https://repology.org/project/gitlint/versions
# Docker: https://hub.docker.com/r/jorisroovers/gitlint
docker run --ulimit nofile=1024 -v $(pwd):/repo jorisroovers/gitlint
@@ -134,8 +133,9 @@ Options:
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.
+ (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 to lint. [default: HEAD]
-e, --extra-path PATH Path to a directory or python module with extra
user-defined rules
@@ -147,10 +147,11 @@ Options:
server.
--staged Read staged commit meta-info from the local
repository.
- -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.
+ --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.
@@ -159,6 +160,7 @@ 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'.
@@ -246,19 +248,21 @@ git log -1 --pretty=%B 62c0519 | gitlint
Note that gitlint requires that you specify `--pretty=%B` (=only print the log message, not the metadata),
future versions of gitlint might fix this and not require the `--pretty` argument.
-## Linting a range of commits
+## Linting specific commits
-_Introduced in gitlint v0.9.0 (experimental in v0.8.0)_
+Gitlint allows users to lint a specific commit:
+```sh
+gitlint --commit 019cf40580a471a3958d3c346aa8bfd265fe5e16
+gitlint --commit 019cf40 # short SHAs work too
+```
-Gitlint allows users to lint a number of commits at once like so:
+You can also lint multiple commits at once like so:
```sh
# Lint a specific commit range:
gitlint --commits "019cf40...d6bc75a"
# You can also use git's special references:
gitlint --commits "origin..HEAD"
-# Or specify a single specific commit in refspec format, like so:
-gitlint --commits "019cf40^...019cf40"
```
The `--commits` flag takes a **single** refspec argument or commit range. Basically, any range that is understood
@@ -271,9 +275,8 @@ script to lint an arbitrary set of commits, like shown in the example below.
#!/bin/sh
for commit in $(git rev-list master); do
- commit_msg=$(git log -1 --pretty=%B $commit)
- echo "$commit"
- echo "$commit_msg" | gitlint
+ echo "Commit $commit"
+ gitlint --commit $commit
echo "--------"
done
```
@@ -309,7 +312,6 @@ general `ignore-merge-commits`, `ignore-revert-commits`, `ignore-fixup-commits`
[using one of the various ways to configure gitlint](configuration.md).
## Ignoring commits
-_Introduced in gitlint v0.10.0_
You can configure gitlint to ignore specific commits or parts of a commit.
@@ -317,8 +319,7 @@ One way to do this, is to by [adding a gitline-ignore line to your commit messag
If you have a case where you want to ignore a certain type of commits all-together, you can
use gitlint's *ignore* rules.
-Here's an example gitlint file that configures gitlint to ignore rules `title-max-length` and `body-min-length`
-for all commits with a title starting with *"Release"*.
+Here's a few examples snippets from a `.gitlint` file:
```ini
[ignore-by-title]
@@ -332,6 +333,11 @@ ignore=title-max-length,body-min-length
# Match commits message bodies that have a line that contains 'release'
regex=(.*)release(.*)
ignore=all
+
+[ignore-by-author-name]
+# Match commits by author name (e.g. ignore all rules when a commit is made by dependabot)
+regex=dependabot
+ignore=all
```
If you just want to ignore certain lines in a commit, you can do that using the