AI-generated conventional commit messages using a local LLM via an OpenAI-compatible API.
Installs a prepare-commit-msg git hook that automatically generates a commit message from your staged changes. Runs entirely locally — no cloud APIs, no latency.
- Go 1.25+
- A local OpenAI-compatible API server (e.g. LM Studio) running at
http://127.0.0.1:1234 - A loaded model (default:
google/gemma-3n-e4b)
go install github.com/nicholls-inc/commit-massage@latestThen install the git hook in any repository:
cd your-repo
commit-massage installUse --force to overwrite an existing prepare-commit-msg hook.
Just commit as normal:
git add .
git commitThe hook generates a conventional commit message from your staged diff and pre-fills the editor. Edit or accept it.
Messages you provide explicitly are left alone:
git commit -m "my manual message" # hook does nothingcommit-massage uninstall| Environment Variable | Default | Description |
|---|---|---|
COMMIT_MASSAGE_MODEL |
google/gemma-3n-e4b |
Model to use |
COMMIT_MASSAGE_URL |
http://127.0.0.1:1234 |
OpenAI-compatible API server URL |
If you're fine-tuning your own model for commit message generation, the prepare-training command converts CommitBench JSONL into training-ready data that matches the exact prompt format used at inference time:
commit-massage prepare-training commitbench.jsonl training.jsonlThis applies the same diff preprocessing used during inference (noise filtering, file importance ranking, smart truncation), derives file change stats, and outputs OpenAI chat completion JSONL. Entries with only noise (lock files, generated code, etc.) are automatically skipped. Progress stats are reported to stderr.
See docs/guides/mlx-fine-tuning.md for a complete guide on fine-tuning with MLX on Apple Silicon.
| Command | Description |
|---|---|
commit-massage install [--force] |
Install the git hook |
commit-massage uninstall |
Remove the git hook |
commit-massage generate <file> [source] |
Generate a commit message (called by the hook) |
commit-massage prepare-training <in> <out> |
Prepare CommitBench JSONL for fine-tuning |