Skip to main content

ollama-commit

PyPI version CI Python versions License: MIT

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 — --yes flag 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

  1. Reads git diff --staged from the current repository
  2. Sends the diff (and optional hint) to your local Ollama model
  3. Receives a Conventional Commit formatted message
  4. 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.

Metadata

Release files for ollama-commit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollama-commit 0.1.0
File Size Uploaded
ollama_commit-0.1.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ollama-commit 0.1.0
File Interpreter ABI Platform
ollama_commit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / ollama_commit-0.1.0.tar.gz

Download URL ollama_commit-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8e225586bb2d4cda5a04123d9ac7a1e828f5e1eac799bf3cf8aaa1a2854ee438
BLAKE2b-256 checksum
How to use checksums
2afbdc96de215c56b1b98d83b3093eaa780f3bee6283d9748d3b0a01ddbcf67f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / ollama_commit-0.1.0-py3-none-any.whl

Download URL ollama_commit-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c5c2da3372d730893e28c688580249d0ff13deb285e88c4188862991c91c1d3
BLAKE2b-256 checksum
How to use checksums
539f7f3b1c7a6f1e862c8b5bf53502e699b6902085f0edd076f8a14b11d0aaf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page