commitfmt
A git commit message formatter written in Rust.
Features
- Enforces subject line length (default: 50 chars)
- Wraps body lines (default: 72 chars)
- Preserves git comments and diffs
- Works seamlessly with editors like nvim
- Configurable via
.commitfmt.toml
Installation
Or build from source:
Usage
Format from stdin
|
Format a file in-place
Use with nvim
Add to your git config:
Then use with a git hook in .git/hooks/commit-msg:
#!/bin/sh
Custom config
Create .commitfmt.toml in your project:
= 50
= 72
How it works
- Subject lines longer than the max length have overflow words moved to the body
- Body lines longer than max are wrapped at word boundaries
- Lines starting with
#(git comments/diffs) are preserved - Intentional line breaks in the body are maintained
License
MIT