Skip to content

Latest commit

Β 

History

History
121 lines (84 loc) Β· 2.64 KB

File metadata and controls

121 lines (84 loc) Β· 2.64 KB

AI Commit

Python License: MIT PyPI version PRs Welcome

An intelligent CLI tool that generates meaningful commit messages for your staged Git changes using AI

Powered by Ollama with smart fallback mechanisms


πŸ“‹ Table of Contents


✨ Features

  • πŸ€– 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 -y flag
  • πŸ“‹ Smart rules: Contextual commit patterns for specific scenarios

πŸš€ Installation

Quick Install (Recommended)

git clone https://github.com/m3/ai-commit.git
cd ai-commit
./install.sh

Package Install

pip install ai-commit

Manual Install

pip install -r requirements.txt
chmod +x ai_commit.py

πŸ’‘ Usage

# Interactive mode
ai-commit

# Auto-commit with generated message
ai-commit -y

# Get help
ai-commit --help

βš™οΈ Prerequisites

  • Python 3.7+
  • Git repository with staged changes
  • Ollama (optional, for AI-powered messages)

πŸ€– Ollama Setup

  1. Install Ollama from https://ollama.ai
  2. Pull the model: ollama pull mistral
  3. Ensure Ollama is running: ollama serve

πŸ”§ How It Works

  1. Stage your changes: git add <files>
  2. Run ai-commit: The tool analyzes your staged changes
  3. AI generation: Uses Ollama to create a contextual commit message
  4. Review & commit: Edit if needed, then commit with automatic push

πŸ“– Example

$ 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!

πŸ“„ License

MIT License - see LICENSE file for details