Commit message linter and formatter
Project description
gitfluff
Commit message linter with presets, custom formats, and cleanup automation. Fully compliant with Conventional Commits 1.0.0. Skips linting while Git is creating a merge commit.
This Python package distributes prebuilt gitfluff binaries. On first use, the correct release binary for your platform is downloaded and cached under ~/.cache/gitfluff.
Quick Start
Install with uv:
uv tool install gitfluff
Run without installation (uvx):
uvx gitfluff --version
Lint a commit message:
gitfluff lint .git/COMMIT_EDITMSG
Auto-clean and rewrite:
gitfluff lint .git/COMMIT_EDITMSG --write
Optional: fail after rewrite (recommended for hooks)
Add a .gitfluff.toml to enable automatic cleanup and stop the commit if a rewrite happened:
preset = "conventional"
write = true
[rules]
exit_nonzero_on_rewrite = true
Hook Integrations
Native Git Hook
Install commit-msg hook:
gitfluff hook install commit-msg
With auto-cleanup:
gitfluff hook install commit-msg --write
pre-commit Framework
Add to .pre-commit-config.yaml:
default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/Goldziher/gitfluff
rev: v0.8.0
hooks:
- id: gitfluff-lint
stages: [commit-msg]
# args: ["--write"] # optional, or set `write = true` in .gitfluff.toml
# args: ["--msg-pattern", "^JIRA-[0-9]+: .+"] # optional regex override
Install the hooks:
pre-commit install
Lefthook (uvx)
Add to lefthook.yml:
commit-msg:
commands:
gitfluff:
run: uvx gitfluff lint {1}
Install hooks:
npx lefthook install
Optional configuration
No configuration is required—the default Conventional Commits rules apply immediately. If you want project overrides, create .gitfluff.toml:
preset = "conventional-body" # optional preset override
write = true
[rules]
no_emojis = true
title_suffix = "\\(JIRA-[0-9]+\\)"
exit_nonzero_on_rewrite = true
Any setting can be left out; omit the file entirely to keep defaults.
Advanced usage
- Override rules per-invocation using CLI flags (e.g.
--preset,--msg-pattern,--cleanup-pattern,--exclude,--cleanup,--single-line,--no-emojis,--ascii-only,--title-prefix,--title-suffix). - Set
GITFLUFF_BINARYto point at a custom build when testing unpublished versions. - Clear the cache (
rm ~/.cache/gitfluff/gitfluff*) to force a fresh download.
License
MIT © Na'aman Hirschfeld and contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitfluff-0.8.0.tar.gz.
File metadata
- Download URL: gitfluff-0.8.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaecd3984d96f77f91f2c6b5cc1af7e965ba90e72f529679fce2a116bab5be7d
|
|
| MD5 |
9f2049efcf49e93a9c79f7fbce470e36
|
|
| BLAKE2b-256 |
17ff5a0699cbf4f2eff8ec9e415bd54c869143c19ce7a733081ac53f0cb1b33e
|
Provenance
The following attestation bundles were made for gitfluff-0.8.0.tar.gz:
Publisher:
publish.yaml on Goldziher/gitfluff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitfluff-0.8.0.tar.gz -
Subject digest:
eaecd3984d96f77f91f2c6b5cc1af7e965ba90e72f529679fce2a116bab5be7d - Sigstore transparency entry: 833637790
- Sigstore integration time:
-
Permalink:
Goldziher/gitfluff@63b575db8c8589ab3ba58aa3cdb03b3298b0532a -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/Goldziher
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@63b575db8c8589ab3ba58aa3cdb03b3298b0532a -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitfluff-0.8.0-py3-none-any.whl.
File metadata
- Download URL: gitfluff-0.8.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4b7dda09b94164f1330d9899fb2783a66adfe232ec51b762a950e9f1dda3b64
|
|
| MD5 |
cbe71b7e54ba8ec2e7b8213217630c0e
|
|
| BLAKE2b-256 |
4e39fe6d34c553b13fbfa97b57a3d7b4d4353b1d8d2ffd075a267f01d32c527e
|
Provenance
The following attestation bundles were made for gitfluff-0.8.0-py3-none-any.whl:
Publisher:
publish.yaml on Goldziher/gitfluff
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitfluff-0.8.0-py3-none-any.whl -
Subject digest:
c4b7dda09b94164f1330d9899fb2783a66adfe232ec51b762a950e9f1dda3b64 - Sigstore transparency entry: 833637791
- Sigstore integration time:
-
Permalink:
Goldziher/gitfluff@63b575db8c8589ab3ba58aa3cdb03b3298b0532a -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/Goldziher
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@63b575db8c8589ab3ba58aa3cdb03b3298b0532a -
Trigger Event:
push
-
Statement type: