AI-Commit AI-Commit streamlines your Git workflow with AI—focused on three core tasks that matter
- Generate Conventional Commits-compliant messages
- Run a quick AI code review on staged diffs
- Review/enforce commit message style (clarity, informativeness, consistency)
It supports multiple providers:
- OpenAI (default)
- Google Gemini
- Anthropic Claude
- DeepSeek
- Ollama (local models)
- OpenRouter (multi-model gateway)
Focus on better commits, consistent standards, and reduced toil—right from your terminal.
Repository: https://github.com/renatogalera/ai-commit
The script detects your OS/arch, downloads the latest release, makes it executable, and installs to /usr/local/bin (using sudo when needed).
curl -sL https://raw.githubusercontent.com/renatogalera/ai-commit/main/scripts/install_ai_commit.sh | bashIf you’re not root, it’ll prompt for
sudoto move the binary.
git clone https://github.com/renatogalera/ai-commit.git
cd ai-commit
go build -o ai-commit ./cmd/ai-commit
sudo mv ai-commit /usr/local/bin/- AI-powered commit messages that follow Conventional Commits.
- AI code review (
ai-commit review) on staged diffs (style, refactor hints, simple risks). - Commit message style review (
--review-message) to enforce clarity & quality. - Interactive TUI to refine messages, switch types, view full diff, and (where supported) stream AI output.
- Non-interactive mode (
--force) for scripts/CI. - Semantic release assist (
--semantic-release, with optional--manual-semver). - Interactive split commits (
--interactive-split) with chunk selection/inversion. - Emoji support (
--emoji) mapped to commit types. - Custom templates (
--template) and prompt template (promptTemplatein config). - Changelog generation (
ai-commit changelog) between tags or time ranges. - Ticket auto-detection from branch names (JIRA, GitHub, Linear) via
{TICKET_ID}template placeholder. - Git hook integration (
ai-commit hook install) for automatic commit message generation. - Scope auto-suggestion from changed file paths to guide the AI.
- Diff/prompt limits to bound payload sizes.
- Lock file filtering for cleaner AI context.
On first run, AI-Commit creates:
~/.config/ai-commit/config.yaml
Path is derived from the binary name; if you rename the binary, the folder matches the new name.
authorName: "Your Name"
authorEmail: "youremail@example.com"
provider: "openai" # default provider if no CLI flag is given
providers:
openai:
apiKey: ""
model: "chatgpt-4o-latest"
baseURL: "https://api.openai.com/v1"
google:
apiKey: ""
model: "gemini-2.5-flash"
baseURL: ""
anthropic:
apiKey: ""
model: "claude-3-7-sonnet-latest"
baseURL: "https://api.anthropic.com"
deepseek:
apiKey: ""
model: "deepseek-chat"
baseURL: "https://api.deepseek.com/v1"
openrouter:
apiKey: ""
model: "openrouter/auto"
baseURL: "https://openrouter.ai/api/v1"
ollama:
apiKey: "" # Not required
model: "llama2"
baseURL: "http://localhost:11434"
limits:
diff:
enabled: false
maxChars: 0
prompt:
enabled: false
maxChars: 0
semanticRelease: false
interactiveSplit: false
enableEmoji: false
commitType: "" # Optional default
template: "" # Optional commit message template; can use {COMMIT_MESSAGE}, {GIT_BRANCH}, and {TICKET_ID}
promptTemplate: "" # Optional global prompt template for AI prompts
ticketPattern: "" # Custom regex for ticket extraction from branch names (default: auto-detect JIRA, GitHub, Linear)
commitTypes:
- type: "feat" emoji: "✨"
- type: "fix" emoji: "🐛"
- type: "docs" emoji: "📚"
- type: "style" emoji: "💎"
- type: "refactor" emoji: "♻️"
- type: "test" emoji: "🧪"
- type: "chore" emoji: "🔧"
- type: "perf" emoji: "🚀"
- type: "build" emoji: "📦"
- type: "ci" emoji: "👷"
lockFiles:
- "go.mod"
- "go.sum"Notes
- Command-line flags override config values.
authorName/authorEmailare used forgitauthoring byCommitChanges. Set these to your identity (the tool does not read your git config).promptTemplateinfluences the prompts for message generation, code reviews, and style checks.limits.diff/promptallow truncation/summarization before sending to providers.
For each provider, the code observes:
${PROVIDER}_API_KEY(e.g.,OPENAI_API_KEY,GOOGLE_API_KEY,ANTHROPIC_API_KEY,DEEPSEEK_API_KEY,OPENROUTER_API_KEY)${PROVIDER}_BASE_URL(e.g.,OPENAI_BASE_URL,GOOGLE_BASE_URL, …,OLLAMA_BASE_URL)
- Stage changes
git add .- Generate a commit message (interactive)
ai-commitTUI keybindings
- Confirm commit:
Enterory - Regenerate:
r(limited attempts) - Change commit type:
t - Edit commit message:
e(save withCtrl+s, cancelEsc) - Edit extra prompt text:
p(save withCtrl+s, cancelEsc) - View full diff:
l(exit diff withEscorq) - Toggle help:
? - Quit:
q/Esc/Ctrl+C
Style review display:
- If the selected provider does not stream, style-review suggestions (when
--review-messageis enabled) are shown in the TUI.- For streaming providers, style review is not yet shown live inside the TUI.
ai-commit [flags]
ai-commit review
ai-commit summarize
ai-commit changelog [fromRef..toRef]
ai-commit hook install|uninstall
--provider— one of:openai,google,anthropic,deepseek,ollama,openrouter--model— overridesproviders.<name>.model--apiKey— overridesproviders.<name>.apiKeyor${PROVIDER}_API_KEY--baseURL— overridesproviders.<name>.baseURLor${PROVIDER}_BASE_URL--language— language for prompts/responses (default:english)--commit-type— force a Conventional Commit type (feat,fix, …)--template— apply a template to the final message (supports{COMMIT_MESSAGE},{GIT_BRANCH}, and{TICKET_ID})--review-message— run AI style review on the generated commit message--msg-only— generate commit message and print to stdout (used by git hooks)
--force— non-interactive; prints style feedback (if any) then commits immediately--semantic-release— compute next version from latest commit and create a tag--manual-semver— with--semantic-release, choose version via TUI--interactive-split— open the chunk-based split TUI
-
review— AI code review of staged changesai-commit review
-
summarize— pick a commit via an in-terminal fuzzy finder and generate an AI summaryai-commit summarize
-
changelog— generate an AI-powered changelog between two refsai-commit changelog v0.10.0..v0.11.0 ai-commit changelog --since=”2 weeks ago” ai-commit changelog --output CHANGELOG.md ai-commit changelog # auto-detect: last two tags -
hook install/hook uninstall— manage theprepare-commit-msggit hookai-commit hook install # install hook ai-commit hook install --force # overwrite existing hook ai-commit hook uninstall # remove hook
The “fuzzy finder” is embedded via a Go library; no external
fzfbinary is required.
Interactive, English, OpenAI
ai-commit --provider=openai --model=chatgpt-4o-latest --language=englishForce commit + style review (non-interactive)
ai-commit --force --review-messageInteractive with style review (non-streaming providers show feedback in TUI)
ai-commit --provider=google --model=models/gemini-2.5-flash --review-messageUse Anthropic via env vars
export ANTHROPIC_API_KEY=sk-...
ai-commit --provider=anthropic --model=claude-3-7-sonnet-latestDeepSeek with explicit base URL
ai-commit --provider=deepseek --model=deepseek-chat --baseURL=https://api.deepseek.com/v1 --apiKey=sk-...Ollama (local)
ai-commit --provider=ollama --model=llama2 --baseURL=http://localhost:11434OpenRouter
ai-commit --provider=openrouter --model=openrouter/auto --apiKey=sk-...Interactive split
ai-commit --interactive-splitSemantic release (manual selection)
ai-commit --semantic-release --manual-semverGenerate changelog between releases
ai-commit changelog v0.10.0..v0.11.0
ai-commit changelog --since="2 weeks ago" --output CHANGELOG.mdUse ticket ID from branch in template
# config.yaml
template: "{COMMIT_MESSAGE}\n\nRefs: {TICKET_ID}"# On branch feature/PROJ-456-add-login:
ai-commit
# Result: "feat(auth): add login\n\nRefs: PROJ-456"Install as git hook
ai-commit hook install
# Now 'git commit' auto-generates AI messages| Provider | API key required | Default model (example) | Base URL (example) | Streaming in code |
|---|---|---|---|---|
| OpenAI | Yes | chatgpt-4o-latest |
https://api.openai.com/v1 |
Yes |
| Yes | gemini-2.5-flash |
(default) | No | |
| Anthropic | Yes | claude-3-7-sonnet-latest |
https://api.anthropic.com |
Yes |
| DeepSeek | Yes | deepseek-chat |
https://api.deepseek.com/v1 |
Yes |
| OpenRouter | Yes | openrouter/auto |
https://openrouter.ai/api/v1 |
Yes |
| Ollama | No | llama2 |
http://localhost:11434 |
No |
Env vars:
${PROVIDER}_API_KEYand${PROVIDER}_BASE_URL(uppercase provider name).
- Streaming: If the provider implements streaming, the TUI streams completion tokens while showing a progress pulse.
- Diff view: Press
lto inspect the full Git diff inside the TUI. - Commit type guess: If not forced, the UI guesses a type from the first line and lets you override with
t. - Regeneration limit: Default max of 3 successive regenerations per run (see UI label).
-
Non-interactive (
--force): style feedback prints to the terminal before the commit. If issues are found, it prints a short, styled block; if not, it remains quiet or shows “No issues found.” -
Interactive:
- Non-streaming providers: style feedback appears in the TUI alongside the generated message.
- Streaming providers: style feedback inside the TUI is not yet implemented.
You can wrap the final AI message with a template, e.g.:
template: |
{COMMIT_MESSAGE}
Branch: {GIT_BRANCH}
Refs: {TICKET_ID}Placeholders:
{COMMIT_MESSAGE}— replaced with the AI-generated (and type-prefixed) message{GIT_BRANCH}— resolved viagitat runtime{TICKET_ID}— auto-extracted from the branch name (supports JIRAPROJ-123, GitHub#42/GH-42, LinearENG-456). Configure a custom regex withticketPatternin config.
-
Lock files: diffs for paths listed in
lockFilesare filtered out from the AI prompt to reduce noise. -
Limits:
limits.diff: truncate/summarize diffs before promptinglimits.prompt: hard cap the final prompt size (truncated with...)
- Empty commit message: if AI returns an empty string, the tool aborts (non-interactive) or stays in the UI. Try regenerating or inspecting the diff.
- “API key required” errors: ensure either
--apiKey, the${PROVIDER}_API_KEYenvironment variable, or a non-emptyproviders.<name>.apiKeyis set. - Ollama base URL: must be valid. If you run into connectivity or 4xx from a provider, confirm your endpoint and headers (especially for self-hosted gateways).
- Author identity: set
authorName/authorEmailinconfig.yamlto avoid commits with default values.
- AI-Commit sends your diffs/prompts to the configured provider(s). Review your provider’s data retention and privacy policies. For highly sensitive repos, prefer local providers (e.g., Ollama) or configure strict limits.
MIT (project’s chart mentions MIT; keep the repo’s LICENSE in sync with public statements).
- ✅ Split-commit TUI with chunk selection/inversion
- ✅ Summarize commits with fuzzy finder
- ✅ AI-powered changelog generation (
ai-commit changelog) - ✅ Ticket auto-detection from branch names (
{TICKET_ID}) - ✅ Git hook integration (
ai-commit hook install) - ✅ Scope auto-suggestion from changed file paths
- ✅ CI pipeline with tests and linting
- ✅ Comprehensive test suite (150+ test cases)
- 🔜 In-TUI style review for streaming providers
