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.
Features
- ๐ง Local LLM โ uses Ollama, no API keys needed
- ๐ฟ Branch-Aware Context โ Infers conventional types and scopes directly from your active git branch
- ๐ Multiple commit styles โ conventional, simple, detailed
- ๐ Regenerate โ not happy? generate a new message instantly
- โ๏ธ Edit before commit โ open your editor to tweak the message safely (
git commit -m ... -e) - โ๏ธ 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 komitinstead.
# 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 & Maintenance
Instead of creating a commit message, you can manage the application lifetime using these distinct actions:
komit init # Interactively build or overwrite your global config.toml file
komit update # Safely checks for and installs down the latest tracking version
komit uninstall # Complete system removal (clears global aliases, configs, variables, and packaging)
CLI flags
komit [--style STYLE] [--model MODEL] [--ollama-url URL] [--max_diff N] [--timeout SEC] [--include_branch_name BOOL] [--dry-run]
| Flag | Short | Options / Type | Default | Description |
|---|---|---|---|---|
--style |
-s |
conventional, simple, detailed |
None (uses config) |
Choose the output template formatting engine |
--model |
-m |
String (any Ollama model tag) | None (uses config) |
Target local model signature |
--ollama-url |
-u |
Valid URL | None (uses config) |
Set alternative Ollama API endpoint host |
--max_diff |
โ | Integer | None (uses config) |
Maximum diff character truncation length |
--timeout |
โ | Integer | None (uses config) |
Maximum generation time frame allowance in seconds |
--include_branch_name |
-ib |
True / False |
None (uses config) |
Enable context mapping and suffixing with current branch name |
--dry-run |
-dr |
Flag (store_true) | False |
Halts execution gracefully at preview step without creating a commit |
--config |
โ | Path String | None |
Read execution parameters from a non-standard configuration layout |
--deep |
โ | Flag (store_true) | False |
Summarize each file separately |
Examples
# Force simple formatting mode execution
komit --style simple
# Use smaller parameter scale weights to save resources
komit --model llama3.2:3b
# Track structural tags across distinct remote targets
komit --ollama-url [http://192.168.1.10:11434](http://192.168.1.10:11434)
# Match branch contexts strictly to evaluate output properties
komit -ib True --dry-run
# Run against explicit local parameters
komit --config ~/my-config.toml
Interactive Experience
When invoked, komit structures your staged workspace and interactive paths using rich terminal layouts:
โฌโโโโโโโโโโโโโโโโโโโโโโโโ Staged files (3) โโโโโโโโโโโโโโโโโโโโโโโโโฌ
โ โข src/auth.py โ
โ โข tests/test_auth.py โ
โ โข README.md โ
โดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโด
Branch name: feature/auth-tokens
Model: qwen2.5:7b ยท Style: conventional
โ Generating commit message...
โฌโโโโโโโโโโโโโโโโโโโโ Suggested commit message โโโโโโโโโโโโโโโโโโโโโฌ
โ feat(auth): add JWT authentication token engine [feature/auth-tโฆ โ
โดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโด
ยป Choose an action: (y)es, (n)o, (e)dit, (r)egenerate [y]:
Response Path Mappings
| Option | Key | Behavior |
|---|---|---|
| Yes | y |
Instantly runs standard non-interactive git commit -m mapping directly to the output. |
| No | n |
Terminates routine execution without impacting staged files. |
| Edit | e |
Executes git commit -m ... -e, loading the generated message straight into your local environment editor ($EDITOR) for explicit manual overrides. |
| Regenerate | r |
Restrikes the Ollama Chat API endpoint using structural variance to provide a fresh alternative message option. |
Branch Name Parsing (Smart Inference)
When --include_branch_name is enabled, komit automatically reads your current Git branch name to guess the correct commit type and scope before asking the AI to write the message.
If your branch follows common naming patterns like type/scope-description or type-scope, it extracts the details instantly:
feat/auth-login$\rightarrow$ Type:feat, Scope:authfix/ui_button$\rightarrow$ Type:fix, Scope:ui_button
Supported Types
The parser actively detects these standard conventional commit types:
feat, fix, chore, docs, style, refactor, test, ci, and perf.
Configuration Schema
Run komit init to automatically provision a configuration folder or overwrite file defaults. The values are securely maintained globally under ~/.config/komit/config.toml (or your platform configuration equivalent via platformdirs standards):
model = "qwen2.5:7b"
style = "conventional"
ollama_url = "http://localhost:11434"
max_diff_length = 4000
timeout = 60
include_branch_name = true
Note: Runtime arguments passed via your terminal interface explicitly supersede structural rules defined inside your persistent configurations.
Commit Style Outputs
Conventional (Default Pattern)
feat(auth): add user authentication [feature/login]
fix(api): resolve null pointer in response pipeline [bugfix/cors]
Simple
Add user authentication [feature/login]
Fix null pointer in response pipeline [bugfix/cors]
Detailed
feat(auth): add user authentication [feature/login]
- Add JWT token generation pipeline
- Implement password security layers using bcrypt primitives
- Append rotation verification routes
Maintenance
# Upgrading tracking states
komit update
# Completely remove all system components
komit uninstall
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feat/my-cool-feature) - Commit your changes (
komit๐) - Push to the branch (
git push origin feat/my-cool-feature) - Open a Pull Request
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file komit-0.4.4.tar.gz.
File metadata
- Download URL: komit-0.4.4.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed397ada7d2a8d9dd5eda4ed1b48b51dcdd50e0335ee9a60d550349cb7e52adf
|
|
| MD5 |
ecef0a30c61da2cdcf15b9117ee7ff10
|
|
| BLAKE2b-256 |
cf16f6d71f88a2dcab208ddeb10b87a38539b5528b111e70092131681bd50b74
|
File details
Details for the file komit-0.4.4-py3-none-any.whl.
File metadata
- Download URL: komit-0.4.4-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
353f550a9f2879eb6137a78642e2f5e864b0221ab19954f2ce7fa3df3ab37539
|
|
| MD5 |
b7b730f4a9834ce453049d98c9c746e2
|
|
| BLAKE2b-256 |
88bb301f33309504889e7a816db063bec2aa4968e90a09294ba045095021d8f1
|