AI-powered conventional commit message generator. Analyzes your staged git changes and generates clean, meaningful commit messages.
Writing good commit messages is tedious. Let AI do it. Just stage your changes and run gitcommitgen.
npm install -g @fanioz/gitcommitgenSet 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.
# 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 --editgit commit -m "$(gitcommitgen)"- 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)
| Provider | Default model | Env var |
|---|---|---|
| OpenAI | gpt-4o-mini | OPENAI_API_KEY |
| Anthropic | claude-haiku-4-5 | ANTHROPIC_API_KEY |
MIT