Generate Git commit messages from staged diffs using your preferred LLM CLI.
git-ai-commit does not talk to LLM APIs directly. Instead, it delegates generation to existing LLM CLIs such as Claude Code, Gemini, or Codex, so no API keys, SDKs, or vendor-specific integrations are required.
Package managers:
Homebrew:
brew tap takai/tap
brew install git-ai-commitmise:
mise use -g github:takai/git-ai-commit@latestBuild from source (outputs to bin/):
make buildPut bin/git-ai-commit on your PATH to enable git ai-commit.
git ai-commit [options]Common options:
--context VALUEAdditional context for the commit message--context-file VALUEFile containing additional context--prompt VALUEBundled prompt preset:default,conventional,gitmoji,karma--prompt-file VALUEPath to a custom prompt file--engine VALUEOverride engine name--amendAmend the previous commit-a,--allStage modified and deleted files before generating the message-i,--include VALUEStage specific files before generating the message-x,--exclude VALUEHide specific files from the diff for message generation--debug-promptPrint the prompt before executing the engine--debug-commandPrint the engine command before execution-h,--helpShow help
Configuration is layered, allowing global defaults with per-repository overrides:
- User config:
~/.config/git-ai-commit/config.toml - Repo config:
.git-ai-commit.tomlat the repository root - Command-line flags
This makes it easy to keep personal preferences (engine, style) while enforcing repository-specific commit rules without relying on hosted services. Repository config is applied only after an initial trust prompt.
Example: Use Codex with Conventional Commits by default
engine = "codex"
prompt = "conventional"Supported settings:
engineDefault engine name (string)promptBundled prompt preset:default,conventional,gitmoji,karmaprompt_filePath to a custom prompt file (relative to the config file)engines.<name>.argsArgument list for the engine command (array of strings)filter.max_file_linesMaximum lines per file in diff (default: 100)filter.exclude_patternsAdditional glob patterns to exclude from difffilter.default_exclude_patternsOverride built-in exclude patterns
git-ai-commit treats LLMs as external commands, not as APIs. This design avoids direct network calls and API key management, and lets you reuse your existing LLM CLI setup.
Supported engines:
claudegeminicodex
If no engine is configured, auto-detection tries commands in this order: claude → gemini → codex. The first available command is used.
Any other engine name is treated as a direct command and executed with the prompt on stdin.
Example: Use ollama with gemma3:4b
engine = "ollama"
[engines.ollama]
args = ["run", "gemma3:4b"]Bundled presets live in internal/config/assets/:
default– Commit messages aligned with the recommendations in Pro Gitconventional– Conventional Commits formatgitmoji– gitmoji-based commit messageskarma– Karma-style commit messages
Example: Use a custom prompt file
engine = "claude"
prompt_file = "prompts/commit.md"Note: prompt and prompt_file are mutually exclusive within the same config file. If both are set, an error is returned. When settings come from different layers (user config vs repo config), the later layer wins.
When the staged diff is large, it can exceed LLM context limits or degrade commit message quality. git-ai-commit automatically filters the diff to help LLMs focus on meaningful changes.
Default behavior:
- Each file is limited to 100 lines (configurable via
filter.max_file_lines) - Lock files and generated files are excluded by default
Default exclude patterns:
**/*.lock,**/*-lock.json,**/*.lock.yaml,**/*-lock.yaml,**/*.lockfile**/*.min.js,**/*.min.css,**/*.map**/go.sum
Example: Customize filtering
[filter]
max_file_lines = 300
# Add patterns to exclude (merged with defaults)
exclude_patterns = [
"**/vendor/**",
"**/*.generated.go",
"**/dist/**"
]
# Or replace defaults entirely
# default_exclude_patterns = ["**/my-lock.json"]If you use Claude Code, you can integrate git-ai-commit as a plugin for a more convenient workflow.
/plugin marketplace add takai/git-ai-commit
/plugin install ai-commit@git-ai-commit-plugins
/ai-commit:staged- Commits only the currently staged changes/ai-commit:all- Stages all pending changes and commits as a single commit/ai-commit:organize- Organizes pending changes into multiple atomic commits
This tool was inspired by how @negipo used a tool like this in his workflow to make his work much more efficient.