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
  • ๐ŸŒฟ 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 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 & 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

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: auth
  • fix/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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-cool-feature)
  3. Commit your changes (komit ๐Ÿ˜‰)
  4. Push to the branch (git push origin feat/my-cool-feature)
  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.3.6.tar.gz (20.0 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.3.6-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for komit-0.3.6.tar.gz
Algorithm Hash digest
SHA256 264cbc5d32d5079ace00906d0116315134ed5f09cb771c7464a498f31444f9e1
MD5 34da342a2e505940fe764ff9ab546152
BLAKE2b-256 0e6716a7c632cecd7b6d925649c62e5b25cf19e562ede5fe86249c897de7e18f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: komit-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 18.6 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.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7f839e229fcb95c362f7f921b0af9375bf6332ac43f4554c2943f78dab6b1947
MD5 dd6063826dbfee2859c161e52b9cc9f3
BLAKE2b-256 fd502d165951055fe42b3a152cf0adfa6e184517370aa670cec614b332a7a5c1

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