commitfmt 0.0.1

A git commit message formatter
Documentation
  • Coverage
  • 0%
    0 out of 19 items documented0 out of 9 items with examples
  • Size
  • Source code size: 25.54 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.25 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 40s Average build duration of successful builds.
  • all releases: 40s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jfernandez/commitfmt
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jfernandez

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

cargo install commitfmt

Or build from source:

cargo install --path .

Usage

Format from stdin

cat commit.txt | commitfmt

Format a file in-place

commitfmt COMMIT_EDITMSG

Use with nvim

Add to your git config:

git config --global core.editor "nvim"

Then use with a git hook in .git/hooks/commit-msg:

#!/bin/sh
commitfmt "$1"

Custom config

Create .commitfmt.toml in your project:

subject_max_length = 50
body_max_line_length = 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