gitfluff keeps your commit history consistent by enforcing structured messages, optional policy rules, and reversible cleanups. Installs ship prebuilt binaries for macOS, Linux, and Windows. The linter is fully compliant with the Conventional Commits 1.0.0 specification, including all header, body, footer, and BREAKING CHANGE requirements.
- Ready out of the box: Conventional Commits enforcement plus automatic removal of common AI signatures (🤖 banners, AI co-author trailers).
- Developer friendly: works with
npx,uvx, Homebrew, Cargo, or a simple binary drop. - Hook aware: drop-in commit-msg integrations for pre-commit, Husky, Lefthook, or raw Git hooks.
- Optional extensions: configure once through
.gitfluff.tomlor override ad-hoc via CLI flags.
Homebrew
brew tap goldziher/tapbrew install gitfluffCargo (Rust)
cargo install gitfluffnpm (global)
npm install -g gitfluffnpx (no install)
npx [email protected] --versionpip (Python)
pip install gitfluffuvx (no install)
uvx gitfluff --versionLint the message Git is editing (pass the path positionally or with --from-file):
gitfluff lint .git/COMMIT_EDITMSGAutomatically clean up matching patterns (e.g. stripped AI banners) and write the result back:
gitfluff lint .git/COMMIT_EDITMSG --writeLint strings from other tools or scripts:
echo "feat: add session caching" | gitfluff lint --stdinInstall a native Git commit-msg hook
gitfluff hook install commit-msgWith auto-cleanup enabled
gitfluff hook install commit-msg --writepre-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.3.3
hooks:
- id: gitfluff-lint
stages: [commit-msg]Then install the hooks:
pre-commit installHusky (npm/npx)
Initialize Husky:
npx husky initCreate the commit-msg hook:
echo 'npx gitfluff lint "$1"' > .husky/commit-msgMake it executable:
chmod +x .husky/commit-msgLefthook (npx)
Add to lefthook.yml:
commit-msg:
commands:
gitfluff:
run: npx gitfluff lint {1}Install the hooks:
npx lefthook installLefthook (uvx)
Add to lefthook.yml:
commit-msg:
commands:
gitfluff:
run: uvx gitfluff lint {1}Install the hooks:
npx lefthook installgitfluff works out of the box with the Conventional Commits preset. A config file is entirely optional. When you do want project-specific rules, place .gitfluff.toml (or the legacy .fluff.toml) in your repo root:
# .gitfluff.toml (all keys optional)
preset = "conventional-body"
[rules]
write = true
[[rules.cleanup]]
find = "(?i)wip"
replace = "WIP"
description = "Normalize WIP markers"Any value defined on the command line overrides the config for that run.
- Presets – Built-in styles:
conventional(default),conventional-body, andsimple(single-line summary). - Body policies – Toggle between single-line commits (
--single-line), required bodies (--require-body), or the preset/config defaults. - Custom rules – Stack multiple
--exclude <regex[:message]>and--cleanup <find->replace>options for ad-hoc policies without editing configuration files. - Temporary overrides – Use
--preset,--message-pattern, or--message-descriptionto tighten rules in CI pipelines or release workflows without touching project config. - Dry-run vs write mode – Without
--write, gitfluff only reports issues and suggested cleanups. Add--writeto apply cleanups to files or emit the cleaned message to stdout when reading from stdin.
Enforce single-line commits, strip trailing whitespace, block "temp" headers, and rewrite in place:
gitfluff lint .git/COMMIT_EDITMSG --exclude "(?i)temp" --cleanup "\\s+$->" --single-line --writeThe default preset enforces every MUST and MUST NOT in Conventional Commits 1.0.0:
- type + optional scope + optional
!+: descriptionheader format - blank-line separation between summary, body, and footers
- support for multi-paragraph bodies and free-form text
- footer token requirements (including
BREAKING CHANGE/BREAKING-CHANGE) - case-insensitive parsing of tokens (except
BREAKING CHANGE, which must be uppercase)
Violations produce actionable messages so you can decide when to teach the linter about project-specific exceptions.
- Binaries: published for macOS (arm64/x86_64), Linux (x86_64, aarch64), Windows (x86_64, i686)
- Registry packages: crates.io, npm, PyPI
- Homebrew tap:
goldziher/tap
Issues and feature requests are welcome via GitHub. Press gitfluff lint --help for the full command reference.