✨ gitc — AI-Powered Git Commit Messages

gitc is a fast, lightweight CLI tool that uses AI to generate clear, consistent, and standards-compliant commit messages — directly from your Git diffs. With built-in support for Conventional Commits, Gitmoji, and fully customizable rules, gitc helps you and your team write better commits, faster.
🚀 Features
- 🧠 AI-Powered Commits — Generates context-aware commit messages via OpenAI-compatible APIs, Ollama (local), or Anthropic.
- 🏠 Local AI Support — Run Ollama locally for private, offline commit generation with no API key required.
- 📝 Standards & Customization — Follows Conventional Commits and optionally adds Gitmoji emojis.
- 🔧 Smart Git Integration — Processes only staged diffs and automatically filters out noise (
node_modules/*, *.lock, etc.).
- ⚙️ Flexible Configuration — CLI flags, environment variables, and
~/.gitc/config.json all supported, with a clear precedence order.
- 🧪 Dry-Run Mode — Preview the prompt that would be sent to AI without making any API call.
📦 Installation
Prerequisites:
- Go: Version 1.25 or higher (required for building from source).
- Git: Required for retrieving staged changes.
- No external runtime dependencies — a single static binary
- API Key: Required for cloud AI providers (OpenAI, Grok, DeepSeek).
- Ollama: Optional for local AI (install from ollama.ai)
Quick Install:
go install github.com/dll-as/gitc@latest
Manual Install
- Download binary from releases
chmod +x gitc
- Move to
/usr/local/bin
Verify Installation
After installation, verify the tool is installed correctly and check its version:
gitc --version
💻 Basic Usage
# 1. Stage your changes
git add . # or gitc -a
# 2. Generate perfect commit message
gitc
# Stage specific files and generate
gitc bot.py
gitc src/utils.go main.go
# Use local Ollama for private commits
gitc --provider ollama
# Pro Tip: Add emojis and specify language
gitc --emoji --lang fa
# Custom commit type
gitc --commit-type fix
# Debug mode: See what prompt would be sent without API cost
gitc --dry-run
Environment Variables
export AI_API_KEY="sk-your-key-here" # For cloud providers
export GITC_LANGUAGE="fa"
export GITC_MODEL="gpt-4"
export GITC_PROVIDER="ollama" # Use local Ollama by default
⚙️ Configuration
Config File (~/.gitc/config.json) :
{
"backend": {
"backend": "openai-compatible",
"base_url": "https://api.openai.com/v1",
"api_key": "",
"model": "gpt-4o-mini",
"timeout": 30000000000,
"max_retries": 3,
"proxy": ""
},
"prompt": {
"language": "en",
"convention": "conventional",
"use_gitmoji": false,
"max_tokens": 1024,
"temperature": 0.3,
"top_p": 1,
"debug": false
},
"git": {
"max_diff_size": 100000,
"exclude_patterns": [
"package-lock.json",
"pnpm-lock.yaml",
"yarn.lock",
"*.lock",
"*.min.js",
"*.bundle.js",
"node_modules/*",
"dist/*",
"build/*",
"*.log",
"*.bak",
"*.swp"
]
}
}
Update Configuration
gitc config --backend ollama --model llama3.2
gitc config --api-key "sk-..." --model "gpt-4o-mini" --base-url https://api.openai.com/v1
gitc config --backend openai-compatible --base-url https://openrouter.ai/api/v1 --api-key sk-or-v1-... --model openrouter/free
Reset to defaults
gitc reset-config
🤖 AI Providers
| Backend value |
Description |
API Key |
Notes |
openai-compatible |
OpenAI or any OpenAI-compatible API (OpenRouter, DeepSeek, Grok, etc.) |
✅ Required |
Default backend |
ollama |
Local Ollama instance |
❌ Not required |
Works offline |
anthropic |
Anthropic Claude (via OpenAI-compatible adapter) |
✅ Required |
— |
Provider examples
OpenAI:
gitc config --backend openai-compatible \
--base-url https://api.openai.com/v1 \
--model gpt-4o-mini \
--api-key sk-...
OpenRouter (free models):
gitc config --backend openai-compatible \
--base-url https://openrouter.ai/api/v1 \
--model openrouter/free \
--api-key sk-or-v1-...
Ollama (local):
gitc config --backend ollama \
--base-url http://localhost:11434 \
--model llama3.2
Anthropic:
gitc config --backend anthropic \
--base-url https://api.anthropic.com/v1 \
--model claude-3-5-haiku-20241022 \
--api-key sk-ant-...
🤝 Contributing
Contributions are welcome! Please check out the contributing guide before making a PR.
评论