An intelligent CLI tool that generates meaningful commit messages for your staged Git changes using AI
Powered by Ollama with smart fallback mechanisms
- ✨ Features
- 🚀 Installation
- 💡 Usage
- ⚙️ Prerequisites
- 🤖 Ollama Setup
- 🔧 How It Works
- 📖 Example
- 📄 License
- 🤖 AI-powered: Uses Ollama with local LLM models (default: Mistral)
- 🔄 Fallback system: Works with rule-based generation when Ollama is unavailable
- 📝 Interactive workflow: Edit messages before committing
- 🚀 Auto-commit: Skip interaction with
-yflag - 📋 Smart rules: Contextual commit patterns for specific scenarios
git clone https://github.com/m3/ai-commit.git
cd ai-commit
./install.shpip install ai-commitpip install -r requirements.txt
chmod +x ai_commit.py# Interactive mode
ai-commit
# Auto-commit with generated message
ai-commit -y
# Get help
ai-commit --help- Python 3.7+
- Git repository with staged changes
- Ollama (optional, for AI-powered messages)
- Install Ollama from https://ollama.ai
- Pull the model:
ollama pull mistral - Ensure Ollama is running:
ollama serve
- Stage your changes:
git add <files> - Run ai-commit: The tool analyzes your staged changes
- AI generation: Uses Ollama to create a contextual commit message
- Review & commit: Edit if needed, then commit with automatic push
$ git add src/auth.py
$ ai-commit
📋 Staged files:
📝 src/auth.py
🤖 Generating commit message...
✅ Suggested commit message:
Implement user authentication with JWT tokens
Options:
(y) Use this message
(e) Edit the message
(s) Show diff
(n) Cancel
Choose an option: y
✅ Commit created successfully!
✅ Pushed to remote repository successfully!MIT License - see LICENSE file for details