Never write commit messages again! 🚀
An intelligent git commit tool that uses Google's Gemini AI to automatically generate professional, meaningful commit messages based on your code changes.
🚀 Quick Start • 📖 Features • 💻 Installation • 🎯 Usage • 🔧 Configuration
🤖 AI-Powered Messages Uses Gemini AI to analyze your changes and generate meaningful commit messages 📝 Conventional Commits
Follows industry-standard format ( 🔍 Smart Analysis Analyzes file changes, diffs, and recent commit history for context |
💬 Interactive Mode Review and edit AI suggestions before committing 🚀 Batch Operations Stage, commit, and push in one command 🛡️ Fallback Mode Works perfectly without AI when API key is not available |
# 1. Clone the repository
git clone https://github.com/LinuxCTRL/smart-git-commit.git
cd smart-git-commit
python3 -m venv .venv
source .venv/bin/activate
# 2. Install dependencies
pip install requests
# 3. Set up your API key (optional but recommended)
export GEMINI_API_KEY="your-api-key-here"
# 4. Start using it!
python3 smart_commit.py
Or install globally:
chmod +x install.sh && ./install.sh
smart-commit # Use from anywhere!
python3 smart_commit.py
📺 See example output
🔍 Analyzing repository changes...
📊 Changes Summary:
➕ Added: 2 files
✏️ Modified: 3 files
🤖 Generating commit message...
💡 Suggested commit message:
feat: add user authentication system
❓ Use this message? (Y/n/e): y
✅ Staged all changes
✅ Committed successfully: feat: add user authentication system
❓ Push to remote? (y/N): y
✅ Pushed to origin
# Auto-stage and commit with AI message
python3 smart_commit.py -a
# Auto-stage, commit, and push
python3 smart_commit.py -a -p
# Use custom message
python3 smart_commit.py -a -m "fix: resolve authentication bug"
# Preview what would happen (dry run)
python3 smart_commit.py --dry-run
smart-commit # Interactive mode
smart-commit -a # Auto-stage and commit
smart-commit -a -p # Auto-stage, commit, and push
smart-commit --dry-run # Preview mode
curl -sSL https://raw.githubusercontent.com/LinuxCTRL/smart-commit/refs/heads/master/smart_commit.py | bash
git clone https://github.com/LinuxCTRL/smart-git-commit.git
cd smart-git-commit
chmod +x install.sh
./install.sh
# Download just the main script
curl -O https://raw.githubusercontent.com/LinuxCTRL/smart-commit/refs/heads/master/smart_commit.py
pip install requests
python3 smart_commit.py
-
Get your free API key from Google AI Studio
-
Set environment variable:
# Add to ~/.bashrc or ~/.zshrc export GEMINI_API_KEY="your-api-key-here" # Or set temporarily export GEMINI_API_KEY="your-key"
-
Or pass directly:
python3 smart_commit.py --api-key "your-key"
💡 Pro Tip: The tool works great even without an API key using intelligent fallback logic!
Generated messages follow Conventional Commits specification:
Type | Description | Example |
---|---|---|
feat |
New features | feat: add user dashboard |
fix |
Bug fixes | fix: resolve login issue |
docs |
Documentation | docs: update API guide |
style |
Code formatting | style: fix indentation |
refactor |
Code refactoring | refactor: optimize queries |
test |
Tests | test: add unit tests |
chore |
Maintenance | chore: update dependencies |
graph LR
A[Analyze Changes] --> B[Build Context]
B --> C[AI Generation]
C --> D[User Review]
D --> E[Commit & Push]
B --> F[Fallback Mode]
F --> D
- 🔍 Change Analysis - Scans git status and diffs
- 🧠 Context Building - Gathers file changes, diffs, and commit history
- 🤖 AI Generation - Sends context to Gemini AI for message generation
- 👤 User Review - Present message for approval/editing
- ✅ Git Operations - Stage, commit, and optionally push
🔑 API Key Issues
"No API key found" warning:
- Set
GEMINI_API_KEY
environment variable - Or use
--api-key
parameter - Tool works in fallback mode without AI
API errors:
- Verify your API key is valid
- Check internet connection
- Ensure you haven't exceeded API quotas
🗂️ Git Repository Issues
"Not a git repository" error:
- Make sure you're in a git repository
- Run
git init
if needed - Check you have proper git permissions
🐍 Python Issues
Import errors:
- Install dependencies:
pip install requests
- Ensure Python 3.7+ is installed
- Check your Python PATH
We love contributions! Here are some ways to help:
- 🐛 Report bugs - Found an issue? Let us know!
- 💡 Suggest features - Have ideas? We'd love to hear them!
- 🔧 Submit PRs - Code contributions are welcome!
- 📖 Improve docs - Help make the documentation better!
- Support for other AI providers (OpenAI, Claude, Anthropic)
- Custom commit message templates
- Git hooks integration
- Multi-language support
- VS Code extension
- GitHub Actions integration
This project is licensed under the MIT License - see the LICENSE file for details.
If this tool helps you, please consider:
- ⭐ Starring the repository
- 🐦 Sharing on social media
- 💬 Telling your friends and colleagues
Made with ❤️ by developers, for developers