AI-powered git commit message generator and code reviewer.
- AI Commit Messages: Automatically generate meaningful commit messages based on your staged changes
- Code Review: Analyze code changes for potential bugs, security issues, and code quality problems
- Multi-Provider Support: Works with OpenAI, Claude, Google Gemini, and OpenRouter
- Bilingual: Supports both English and Chinese output
- Git Hooks: Auto review code before commit
go install github.com/go-goll/aigit@latestaigit configFollow the prompts to:
- Select your AI provider (OpenAI/Claude/Google/OpenRouter)
- Enter your API key
- Choose model (optional, uses default)
- Select language (English/Chinese)
Quick setup for OpenRouter:
aigit config provider openrouter
aigit config api_key sk-or-xxx
aigit config model anthropic/claude-sonnet-4-20250514# Stage your changes first
git add .
# Generate commit message
aigit commit
# Or stage all and commit in one command
aigit commit -a
# Auto-commit without confirmation
aigit commit -y# Review all changes (staged + unstaged)
aigit review
# Review only staged changes
aigit review -s# Install pre-commit hook for auto review
aigit hooks install
# Uninstall
aigit hooks uninstall| Command | Description |
|---|---|
aigit config |
Configure AI provider and settings |
aigit commit |
Generate commit message for staged changes |
aigit review |
Review code changes for potential bugs |
aigit hooks install |
Install pre-commit hook |
aigit hooks uninstall |
Uninstall pre-commit hook |
| Flag | Description |
|---|---|
-a, --all |
Stage all changes before commit |
-y, --yes |
Auto-commit without confirmation |
| Flag | Description |
|---|---|
-s, --staged |
Review only staged changes |
Configuration is stored in ~/.aigit/config.json:
{
"provider": "openai",
"api_key": "your-api-key",
"model": "gpt-4o",
"language": "en",
"base_url": ""
}| Provider | Default Model | API Key Source |
|---|---|---|
| OpenAI | gpt-4o | OpenAI Platform |
| Claude | claude-sonnet-4-20250514 | Anthropic Console |
| gemini-1.5-pro | Google AI Studio | |
| OpenRouter | anthropic/claude-sonnet-4-20250514 | OpenRouter |
For users who need to use a proxy or custom endpoint:
{
"provider": "openai",
"api_key": "your-api-key",
"base_url": "https://your-proxy.com/v1"
}$ aigit commit
Staged files:
• internal/auth/handler.go
• internal/auth/middleware.go
Generating commit message...
--- Generated Commit Message ---
feat(auth): add JWT authentication middleware
- Implement JWT token validation
- Add user context extraction
- Support token refresh mechanism
--------------------------------
Commit with this message? [Y/n/e(dit)]: y
✓ Committed successfully!
$ aigit review -s
Reviewing staged changes...
=== Code Review Results ===
**HIGH**: Potential SQL injection in `internal/db/query.go:45`
- User input is directly concatenated into SQL query
- Fix: Use parameterized queries
**MEDIUM**: Missing error handling in `internal/api/handler.go:78`
- HTTP response not checked for errors
- Fix: Add error handling for response.Body.Close()
**LOW**: Unused variable in `internal/utils/helper.go:23`
- Variable `temp` is declared but never used
===========================
MIT License