@fanioz/gitcommitgen
v1.0.1
Published
AI-powered conventional commit message generator
Maintainers
Readme
gitcommitgen
AI-powered conventional commit message generator. Analyzes your staged git changes and generates clean, meaningful commit messages.
Why?
Writing good commit messages is tedious. Let AI do it. Just stage your changes and run gitcommitgen.
Install
npm install -g gitcommitgenSetup
Set your LLM provider API key:
# OpenAI
export OPENAI_API_KEY="sk-..."
# Anthropic
export ANTHROPIC_API_KEY="sk-ant-..."Optional: create a config file at ~/.gitcommitgen.json to set defaults:
{
"provider": "openai",
"model": "gpt-4o-mini",
"commit": true,
"edit": true,
"dryRun": false
}By default, if no configuration file is found and no flags are provided, the tool defaults to --edit mode.
Usage
# Generate and print commit message
gitcommitgen
# Generate and auto-commit
gitcommitgen --commit
# Use a specific provider and model
gitcommitgen --provider anthropic --model claude-haiku-4-5
# Preview: show diff summary and proposed message
gitcommitgen --dry-run
# Edit the generated message before committing
gitcommitgen --commit --editPipe to git commit
git commit -m "$(gitcommitgen)"How it works
- Reads
git diff --stagedto see your changes - Sends the diff to an LLM with a prompt tuned for conventional commits
- Returns a clean commit message (type, optional scope, description)
Supported providers
| Provider | Default model | Env var |
| --------- | ------------------- | -------------------- |
| OpenAI | gpt-4o-mini | OPENAI_API_KEY |
| Anthropic | claude-haiku-4-5 | ANTHROPIC_API_KEY |
License
MIT
