Generate Git commit messages using local LLMs via Ollama
Project description
ollama-commit
Generate Git commit messages using local LLMs via Ollama — no cloud, no API keys, no data leaving your machine.
$ git add src/auth.py
$ ollama-commit
Staged files (1): src/auth.py
Querying mistral via http://localhost:11434…
╭─ Suggested commit message ──────────────────────────────╮
│ feat(auth): add JWT refresh token rotation │
╰──────────────────────────────────────────────────────────╯
Commit with this message? [Y/n]:
Features
- Local-first — uses Ollama, everything runs on your machine
- Conventional Commits — output follows the Conventional Commits spec
- Multiple suggestions — get up to 5 variants and pick the best one (
-n 3) - Context hints — give the model a nudge (
--hint "refactoring auth") - Git hook — auto-fill the commit message editor on every
git commit - Interactive or silent —
--yesflag for scripting and CI
Requirements
- Python ≥ 3.10
- Ollama running locally (
ollama serve) - At least one model pulled:
ollama pull mistral
Installation
pip install ollama-commit
Or for development:
git clone https://github.com/dennisreichenberg/ollama-commit
cd ollama-commit
pip install -e ".[dev]"
Usage
Basic
# Stage your changes, then:
git add .
ollama-commit
Get multiple suggestions
ollama-commit --count 3
Use a different model
ollama-commit --model llama3
ollama-commit --model codellama
Add a context hint
ollama-commit --hint "this fixes the login redirect bug"
Auto-commit without prompting
ollama-commit --yes
Dry run (print only, do not commit)
ollama-commit --dry-run
List available models
ollama-commit models
Git hook (auto-fill on git commit)
# Install hook in current repo
ollama-commit install-hook
# Remove hook
ollama-commit uninstall-hook
Options
| Option | Short | Default | Description |
|---|---|---|---|
--model |
-m |
mistral |
Ollama model to use |
--host |
http://localhost:11434 |
Ollama base URL | |
--count |
-n |
1 |
Number of suggestions (1–5) |
--hint |
-h |
Optional hint for the model | |
--yes |
-y |
Auto-accept and commit | |
--dry-run |
Print message, don't commit |
Recommended models
| Model | Size | Notes |
|---|---|---|
mistral |
4.1 GB | Best quality/speed for commits |
llama3 |
4.7 GB | Excellent for English commits |
codellama |
3.8 GB | Code-focused, good for technical diffs |
phi3 |
2.2 GB | Fast, good quality for small models |
qwen2.5-coder |
4.7 GB | Strong code understanding |
How it works
- Reads
git diff --stagedfrom the current repository - Sends the diff (and optional hint) to your local Ollama model
- Receives a Conventional Commit formatted message
- Optionally commits with that message after confirmation
Configuration via environment variables
export OLLAMA_COMMIT_MODEL=llama3
export OLLAMA_COMMIT_HOST=http://localhost:11434
(Env var support coming in v0.2)
License
MIT — see LICENSE
Contributing
PRs welcome! See CONTRIBUTING.md for guidelines.
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 ollama_commit-0.1.0.tar.gz.
File metadata
- Download URL: ollama_commit-0.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e225586bb2d4cda5a04123d9ac7a1e828f5e1eac799bf3cf8aaa1a2854ee438
|
|
| MD5 |
164609f961283fd75fe1ea5ce5e01bd2
|
|
| BLAKE2b-256 |
2afbdc96de215c56b1b98d83b3093eaa780f3bee6283d9748d3b0a01ddbcf67f
|
Provenance
The following attestation bundles were made for ollama_commit-0.1.0.tar.gz:
Publisher:
ci.yml on dennisreichenberg/ollama-commit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ollama_commit-0.1.0.tar.gz -
Subject digest:
8e225586bb2d4cda5a04123d9ac7a1e828f5e1eac799bf3cf8aaa1a2854ee438 - Sigstore transparency entry: 1332881299
- Sigstore integration time:
-
Permalink:
dennisreichenberg/ollama-commit@6ce938136eecba24a31e925df329894ddfc959bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dennisreichenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@6ce938136eecba24a31e925df329894ddfc959bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file ollama_commit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ollama_commit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5c2da3372d730893e28c688580249d0ff13deb285e88c4188862991c91c1d3
|
|
| MD5 |
c1473c16cef9b6ab4553aed84b9f6030
|
|
| BLAKE2b-256 |
539f7f3b1c7a6f1e862c8b5bf53502e699b6902085f0edd076f8a14b11d0aaf5
|
Provenance
The following attestation bundles were made for ollama_commit-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on dennisreichenberg/ollama-commit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ollama_commit-0.1.0-py3-none-any.whl -
Subject digest:
3c5c2da3372d730893e28c688580249d0ff13deb285e88c4188862991c91c1d3 - Sigstore transparency entry: 1332881444
- Sigstore integration time:
-
Permalink:
dennisreichenberg/ollama-commit@6ce938136eecba24a31e925df329894ddfc959bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dennisreichenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@6ce938136eecba24a31e925df329894ddfc959bd -
Trigger Event:
push
-
Statement type: