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. The binary's SHA-256 checksum is verified against the release's published checksums manifest before extraction.
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
Hook installation respects core.hooksPath (including relative paths) and works correctly in linked git worktrees.
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.9.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
ai_cleanup = true # set to false to disable AI attribution cleanup
title_suffix = "\\(JIRA-[0-9]+\\)"
exit_nonzero_on_rewrite = true
Any setting can be left out; omit the file entirely to keep defaults. Unknown config keys now trigger an error rather than being silently ignored.
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,--no-ai-cleanup). - 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
Release files for gitfluff 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gitfluff-0.9.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gitfluff-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / gitfluff-0.9.0.tar.gz
| Download URL | gitfluff-0.9.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46d5aaee73e5cc8c17c7c9e7efe8a1a231b0021e65627615d41fe817a8e70a9
|
|
BLAKE2b-256 checksum How to use checksums |
985e2d6a90d6b57377ccdc88543036e7d05c9f4c994235d848a86ebef2a83e43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / gitfluff-0.9.0-py3-none-any.whl
| Download URL | gitfluff-0.9.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9600a88525a64b9bbade475bf5503c29ae45304c93f04f42e841cbd0b1411eb
|
|
BLAKE2b-256 checksum How to use checksums |
054431f1c38b19049ac62cdf5ce99c408c5f046b3fbd08b586d10c7c011cfbbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log