AI-powered Git commit message generator
Stop writing boring commit messages. Let AI do it for you.
Features β’ Install β’ Usage β’ Config β’ Contributing
- π Smart Analysis β Reads your
git diffand understands what changed - π€ Multi-Provider AI β Supports OpenAI, Anthropic, Ollama (local/free!), and Gemini
- π Multiple Styles β Conventional Commits, Gitmoji, or Simple format
- π Multi-Language β Generate messages in any language
- β‘ Interactive CLI β Edit, regenerate, copy, or commit directly
- π Zero Config β Works out of the box with sensible defaults
- π§ Git Alias Friendly β Use
scas a short alias
npm install -g smart-commitOr use without installing:
npx smart-commit# 1. Configure your AI provider
sc config
# 2. Stage your changes
git add .
# 3. Generate commit message
scThat's it! Smart Commit analyzes your staged changes and generates a perfect commit message.
# Generate from staged changes
sc
# Stage all changes and generate
sc --all
# or
sc -a
# Commit directly without confirmation
sc --yes
# or
sc -y
# Only copy message to clipboard
sc --copy# Interactive setup
sc config
# Show current config
sc config --show
# Set AI provider
sc config --provider ollama
sc config --provider openai
sc config --provider anthropic
sc config --provider gemini
# Set commit style
sc config --style conventional # feat:, fix:, docs:
sc config --style emoji # β¨, π, π
sc config --style simple # Add, Fix, Update
# Set output language
sc config --language english
sc config --language indonesian
sc config --language spanish
# Set API key
sc config --api-key sk-your-key-here
# Set specific model
sc config --model gpt-4o
sc config --model claude-3-5-sonnet-20241022
sc config --model llama3.2Add this to your ~/.gitconfig for even faster access:
[alias]
ai = !scThen just use:
git ai
git ai --all
git ai --yes| Provider | Model | Free? | Setup |
|---|---|---|---|
| Ollama | llama3.2, codellama, etc. | β Yes | Install Ollama |
| OpenAI | gpt-4o-mini, gpt-4o | β | Get API key |
| Anthropic | Claude 3.5 Sonnet | β | Get API key |
| Gemini | gemini-2.0-flash | β Free tier | Get API key |
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull llama3.2
# Configure smart-commit
sc config --provider ollama --model llama3.2Config is stored in ~/.smart-commit/config.json:
{
"provider": "openai",
"model": "gpt-4o-mini",
"apiKey": "sk-...",
"language": "english",
"style": "conventional",
"autoCommit": false,
"temperature": 0.3
}You can also use environment variables instead of storing API keys:
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=...feat(auth): add OAuth2 login flow
fix(api): handle null response in user endpoint
docs: update installation guide
refactor(utils): simplify date formatting logic
β¨ feat: add dark mode toggle
π fix: resolve memory leak in worker pool
π docs: add API reference for v2
β»οΈ refactor: extract payment logic to service
Add dark mode toggle to settings page
Fix memory leak in background worker pool
Update API reference documentation
Extract payment processing into separate service
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Commit your changes (
sc --yes) - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
MIT Β© Lwuisyy
If this tool helped you, consider giving it a β on GitHub!
