ServicesPortfolioToolsJournalAbout
← Back to Tools
📝
TypeScriptNode.jsCLI CLI Tool

gitcommitgen

AI-powered conventional commit message generator. Analyzes staged changes and generates clean commit messages.

Install
npm install -g @fanioz/gitcommitgen

Analyze your staged git changes and generate clean, meaningful conventional commit messages — powered by AI.

Setup

Set your LLM provider API key:

# OpenAI
export OPENAI_API_KEY="sk-..."

# Anthropic
export ANTHROPIC_API_KEY="sk-ant-..."

Optionally, create a config file at ~/.gitcommitgen.json for defaults:

{
  "provider": "openai",
  "model": "gpt-4o-mini",
  "commit": true,
  "edit": true,
  "dryRun": false
}

Without a config file or flags, 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 --edit

You can also pipe directly to git:

git commit -m "$(gitcommitgen)"

How It Works

  1. Reads git diff --staged to see your changes
  2. Sends the diff to an LLM with a prompt tuned for conventional commits
  3. Returns a clean commit message (type, optional scope, description)

Supported Providers

ProviderDefault ModelEnv Var
OpenAIgpt-4o-miniOPENAI_API_KEY
Anthropicclaude-haiku-4-5ANTHROPIC_API_KEY

Features

  • Zero-config — works out of the box with just an API key
  • Supports OpenAI and Anthropic as providers
  • Config file support for team defaults (~/.gitcommitgen.json)
  • Dry-run mode to preview before committing
  • Edit mode to tweak the generated message
  • Auto-commit with --commit flag