Skip to main content

AI-powered git commit message generator using local LLMs

Project description

🤖 komit

AI-powered git commit message generator using local LLMs via Ollama. No API keys, no internet required — runs completely locally and privately.


PyPI Python License Downloads CI


Features

  • 🧠 Local LLM — uses Ollama, no API keys needed
  • 📝 Multiple commit styles — conventional, simple, detailed
  • 🔄 Regenerate — not happy? generate a new message instantly
  • ✏️ Edit before commit — open your editor to tweak the message
  • ⚙️ CLI flags — control style, model, and more from the command line
  • 📁 Config file — persist your preferences with komit init
  • 🌍 Universal — works via pip, binary, or shell script
  • 🪟 Cross-platform — Linux, macOS, Windows
  • Fast — runs on your machine, no network calls to external APIs
  • 🔒 Ollama validation — checks if Ollama is running and model exists before generating
  • 🔁 Smart updates — detects pip vs binary install and updates accordingly

Requirements

  • Ollama installed and running
  • A local model pulled (e.g. ollama pull qwen2.5:7b)

Recommended Models

Model Size Best for
qwen2.5:7b 4.7GB Best quality
mistral:7b 4.1GB Good balance
llama3.2:3b 2.0GB Fastest
ollama pull qwen2.5:7b

Installation

Option 1 — One line install (Linux/macOS, no Python required)

curl -fsSL https://raw.githubusercontent.com/glemiu6/komit/master/scripts/install.sh | bash

Option 2 — Windows PowerShell

irm https://raw.githubusercontent.com/glemiu6/komit/master/scripts/install.ps1 | iex

Option 3 — pip

pip install komit

Option 4 — pipx (recommended for CLI tools)

pipx install komit

Option 5 — Download binary

Download the binary for your platform from GitHub Releases:

Platform Binary
Linux x86_64 komit-linux-x86_64
macOS Apple Silicon komit-macos-arm64
Windows komit-windows-x86_64.exe

Intel Mac users: use pip install komit instead.

# Linux/macOS
chmod +x komit-*
sudo mv komit-* /usr/local/bin/komit

Setup

Git alias (recommended)

git config --global alias.ai '!komit'

Now you can use git ai as a shortcut.

Shell completion

# bash
echo 'eval "$(register-python-argcomplete komit)"' >> ~/.bashrc
source ~/.bashrc

# zsh
echo 'eval "$(register-python-argcomplete komit)"' >> ~/.zshrc
source ~/.zshrc

Usage

# stage your changes
git add .

# generate commit message
komit

# or via git alias
git ai

# or via shell script
./scripts/commit.sh

Subcommands

komit init       # create config file at ~/.config/komit/config.toml
komit update     # update to latest version
komit uninstall  # remove komit

CLI flags

komit [--style STYLE] [--model MODEL] [--ollama-url URL] [--max-diff N] [--dry-run]
Flag Options Default Description
-s, --style conventional, simple, detailed conventional Commit message style
-m, --model any Ollama model qwen2.5:7b Model to use
-u, --ollama-url any URL http://localhost:11434 Ollama server URL
--max-diff integer 4000 Max diff length sent to model
--dry-run false Preview message without committing
--config path ~/.config/komit/config.toml Path to custom config file

Examples

# use simple style
komit --style simple

# use a faster model
komit --model llama3.2:3b

# detailed style with different model
komit --style detailed --model mistral:7b

# connect to remote Ollama
komit --ollama-url http://192.168.1.10:11434

# preview without committing
komit --dry-run

# use custom config file
komit --config ~/my-config.toml

Interactive prompt

Staged files (3):
  - src/auth.py
  - tests/test_auth.py
  - README.md

Generating commit message... (style: conventional, model: qwen2.5:7b)

Suggested message:
  feat: add JWT authentication with refresh token support

Use this message? (y/n/e to edit/r to regenerate):
Key Action
y Commit with the suggested message
n Cancel
e Open editor to modify the message
r Regenerate a new message

Config File

Run komit init to create a config file at ~/.config/komit/config.toml:

model = "qwen2.5:7b"
style = "conventional"
ollama_url = "http://localhost:11434"
max_diff_length = 4000

CLI flags always override the config file.


Commit Styles

Conventional (default)

feat: add user authentication
fix: resolve null pointer in login flow
docs: update API reference

Simple

Add user authentication
Fix null pointer in login flow
Update API reference

Detailed

feat: add user authentication

- Add JWT token generation
- Add password hashing with bcrypt
- Add refresh token support

Update & Uninstall

# update
komit update

# uninstall
komit uninstall

komit automatically detects whether you installed via pip or binary and uses the correct update method.


Contributing

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature-name)
  3. Commit your changes (komit 😉)
  4. Push to the branch (git push origin feature-name)
  5. Open a Pull Request

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

komit-0.2.15.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

komit-0.2.15-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file komit-0.2.15.tar.gz.

File metadata

  • Download URL: komit-0.2.15.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for komit-0.2.15.tar.gz
Algorithm Hash digest
SHA256 764a0eb7d9db45157416b3c1e4be745bb94045eb55fa29924d035ea6d9e1764c
MD5 03bbbd2cf9789193925bab7c8dab7a0d
BLAKE2b-256 744621e9be75a6700727b7ef9e7154f4c813681b967d37fd42e13b5466103478

See more details on using hashes here.

File details

Details for the file komit-0.2.15-py3-none-any.whl.

File metadata

  • Download URL: komit-0.2.15-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for komit-0.2.15-py3-none-any.whl
Algorithm Hash digest
SHA256 ceda0309de67e93b7bf3e330f459334b68c31e39b8a83614e5f73cd578d261b3
MD5 8570df59f979c679636b13bd6ccb63c2
BLAKE2b-256 f37a5eb1ce8a86693ea8dd5181db7467a72f363824fe1d015449dfc82b67fa8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page