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