AI-Commit is a powerful CLI tool designed to revolutionize your Git workflow by leveraging AI for three key tasks: generating commit messages, providing basic code reviews, and enforcing commit message style guides. By integrating cutting-edge AI models, AI-Commit helps you create meaningful, Conventional Commits-compliant messages, get quick feedback on your code changes, and ensure your commit messages adhere to a high standard of clarity and informativeness—all right from your terminal.
It supports:
Boost your commit quality, enforce standards, and save valuable time with AI-Commit, your all-in-one AI assistant for Git workflows.
https://github.com/renatogalera/ai-commit
You can install AI-Commit using one of two methods: via our automated installation script or by building from source.
The installation script will:
/usr/local/bin
(using sudo
if required).To install via the script, run the following commands in your terminal:
curl -sL https://raw.githubusercontent.com/renatogalera/ai-commit/main/scripts/install_ai_commit.sh | bash
Note: If you are not running as root, the script will prompt for your password to use sudo
when moving the binary.
If you prefer to build AI-Commit manually from source, follow these steps:
git clone https://github.com/renatogalera/ai-commit.git
cd ai-commit
go build -o ai-commit ./cmd/ai-commit
# Optionally, move the binary into your PATH for global access:
sudo mv ai-commit /usr/local/bin/
ai-commit review
subcommand to analyze your staged changes.--review-message
): Automatically review and enforce your commit message style using AI. Get feedback on clarity, informativeness, and overall quality to ensure consistently excellent commit messages. Enable with the --review-message
flag during commit message generation.--force
): Automate commit message generation and style enforcement in scripts or workflows, bypassing the TUI for quick, direct commits.--semantic-release
): Streamline your release process with AI-assisted semantic version bumping. Choose between AI-suggested version updates or manual version selection via TUI (--manual-semver
).--interactive-split
): Gain granular control over your commits with chunk-based staging and commit message generation for partial commits.--emoji
): Add a touch of visual flair to your commit history with automatically included emojis based on commit types.--template
): Tailor commit messages to your team’s style with custom templates, incorporating dynamic values like branch names.l
key) for thorough pre-commit reviews.AI-Commit automatically creates a config.yaml
file at ~/.config/ai-commit/config.yaml
upon first run. This file lets you personalize default settings:
# Your name and email address for git commits.
authorName: "Your Name"
authorEmail: "youremail@example.com"
provider: "phind"
phindApiKey: "" # Phind does not require an API key by default
phindModel: "Phind-70B" # Current Phind model is free
openAiApiKey: "sk-YOUR-OPENAI-KEY"
openaiModel: "gpt-4o-latest"
geminiApiKey: "YOUR-GEMINI-KEY"
geminiModel: "models/gemini-2.0-flash"
anthropicApiKey: "sk-YOUR-ANTHROPIC-KEY"
anthropicModel: "claude-3-5-sonnet-latest"
deepseekApiKey: "YOUR-DEEPSEEK-KEY"
deepseekModel: "deepseek-chat"
semanticRelease: false
interactiveSplit: false
enableEmoji: false
commitType: ""
template: ""
promptTemplate: "" # Customize the AI prompt template for commit messages, reviews, and style checks
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: # Specify lock files to be ignored in diffs for commit messages and reviews
- "go.mod"
- "go.sum"
Note: Command-line flags always take precedence over configuration file values. API keys can be set via environment variables or within
config.yaml
. You can now also customize thepromptTemplate
in this file to adjust the behavior of both commit message generation and code reviews.
API Keys via Environment Variables:
OPENAI_API_KEY
GEMINI_API_KEY
ANTHROPIC_API_KEY
DEEPSEEK_API_KEY
PHIND_API_KEY
git add .
ai-commit
Standard interactive commit message generation, without style review.
Enter
or y
to commit with the generated message.r
to generate a new commit message. Track regen attempts in the UI.t
to select a different commit type, influencing AI generation.e
to manually edit the commit message in the TUI (Ctrl+s
to save, Esc
to cancel).p
to customize the AI prompt text for specific instructions (Ctrl+s
to apply, Esc
to cancel).l
to review the full Git diff within the TUI (Esc
or q
to return).?
to toggle help text showing keybindings.q
, Esc
, or Ctrl+C
to exit without commit.--review-message
, any style feedback from the AI will also be displayed in the TUI (feature to be implemented in future versions for interactive feedback). For now, feedback is shown in the terminal output before the TUI.Main Flags:
--provider
: AI provider selection (openai
, gemini
, anthropic
, deepseek
, phind
).--model
: Specific model choice per provider (e.g., gpt-4
, models/gemini-2.0-flash
, claude-3-5-sonnet-latest
, deepseek-chat
, Phind-70B
).--apiKey
, --geminiApiKey
, --anthropicApiKey
, --deepseekApiKey
, --phindApiKey
: API keys for each provider.--commit-type
: Force a commit type (e.g., fix
, feat
) for non-interactive use or AI guidance.--template
: Custom template for commit messages, wrapping AI output.--prompt
(Deprecated): Use promptTemplate
in config.yaml
for persistent prompt customization instead.Workflow Control Flags:
--force
: Non-interactive commit; skips TUI and commits directly.--semantic-release
: Enables semantic versioning; suggests/creates version tags post-commit.--manual-semver
: With --semantic-release
, manually select version type in TUI.--interactive-split
: Launches chunk-based commit splitting TUI.--emoji
: Adds emojis to commit messages based on type.--review-message
: Enable AI-powered commit message style review. After generating a commit message, AI-Commit sends it to AI for a style review. Feedback is provided in the terminal output, ensuring commit messages are clear, informative, and adhere to best practices.Subcommand:
review
: Trigger AI-powered code review of staged changes:
ai-commit review
summarize
: NEW - Summarize a selected commit using AI. Uses fzf
to pick a commit from the commit history, then displays an AI-generated summary of that commit.
ai-commit summarize
ai-commit summarize
Lists commits with fzf
, and after you pick one, shows an AI-generated summary in the terminal.
ai-commit --review-message
Launches the interactive TUI after generating and AI-reviewing the commit message style.
ai-commit --force --review-message
Directly commits staged changes after generating and AI-reviewing the commit message style, skipping the TUI. Style review feedback is printed to the terminal before commit.
ai-commit review
Executes AI code review and outputs suggestions to the terminal.
ai-commit --semantic-release --manual-semver
Semantic release with manual version selection TUI.
ai-commit --provider=openai --model=gpt-4 --apiKey=sk-...
ai-commit --provider=gemini --model=models/gemini-2.0-flash --geminiApiKey=...
ai-commit --provider=anthropic --model=claude-3-sonnet --anthropicApiKey=...
ai-commit --provider=deepseek --model=deepseek-chat --deepseekApiKey=...
ai-commit --provider=phind --model=Phind-70B # Phind model is currently free; API key is optional
ai-commit --interactive-split