AI-generated Conventional Commit messages from your staged Git diff. Local (Ollama) or cloud (OpenAI).
Project description
commit-msg-ai
AI-generated Conventional Commit messages from your staged Git diff.
Works with local models via Ollama (free, private) or OpenAI (paid).
Features
- ✨ Conventional Commits —
feat,fix,docs,refactor, etc. - 🎨 Gitmoji support —
✨ feat:,🐛 fix:,📝 docs:with--emoji - 🎲 Interactive mode — generate 3 options, pick the best with
--interactive - 💾 Smart caching — re-running on the same diff is instant
- 📊 Amend support — regenerate message for last commit with
--amend - 🌍 Multi-language —
--lang ru,--lang en, 16+ languages - 🪝 Git hook — auto-generate on every
git commit - 🔌 Two providers — Ollama (local) or OpenAI (API)
Install
From PyPI (recommended)
pip install commit-msg-ai
From source
git clone https://github.com/Weretik18/commit-msg-ai.git
cd commit-msg-ai
pip install -e .
Then create a config:
mkdir -p ~/.commit-msg-ai
cp config.example.yaml ~/.commit-msg-ai/config.yaml
Quick start (Ollama, recommended)
- Install Ollama
- Pull a coding model:
ollama pull qwen2.5-coder:7b - Edit
~/.commit-msg-ai/config.yamlto use that model - Stage changes and run:
git add .
commit-msg-ai
Usage
# Default: generate one commit message
commit-msg-ai
# With emoji
commit-msg-ai --emoji
# Pick from 3 options
commit-msg-ai --interactive
# In Russian
commit-msg-ai --lang ru
# Regenerate for last commit (use with git commit --amend)
commit-msg-ai --amend
# Skip cache (always call the model)
commit-msg-ai --no-cache
# Subject line only, no body
commit-msg-ai --no-body
# Pipe straight into git
commit-msg-ai | git commit -F -
Git hook (automatic mode)
commit-msg-ai install-hook
Now every git commit will pre-fill the commit message editor with an AI-generated one.
To remove:
commit-msg-ai uninstall-hook
Commands
| Command | What it does |
|---|---|
commit-msg-ai |
Generate a commit message |
commit-msg-ai install-hook |
Install prepare-commit-msg hook |
commit-msg-ai uninstall-hook |
Remove the hook |
commit-msg-ai clear-cache |
Delete all cached messages |
commit-msg-ai --version |
Show version |
Config
~/.commit-msg-ai/config.yaml:
provider: ollama # or "openai"
ollama:
host: http://localhost:11434
model: qwen2.5-coder:7b
openai:
api_key: "" # or set OPENAI_API_KEY env var
model: gpt-4o-mini
options:
max_length: 72
include_body: true
language: en
Development
# Clone and install in dev mode
git clone https://github.com/Weretik18/commit-msg-ai.git
cd commit-msg-ai
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check commit_msg_ai/ tests/
License
MIT — see LICENSE for details.
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
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 gitmsg_ai-0.2.2.tar.gz.
File metadata
- Download URL: gitmsg_ai-0.2.2.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac2ac8eb585933558af6a7fe6cc82052babf037c11be0f361c944214a883976
|
|
| MD5 |
80460419034057f253c399b631a80b03
|
|
| BLAKE2b-256 |
8b7b58ad991580d391c1133ed757d3f627856072418dbc6b6a9f7f124db97ff8
|
Provenance
The following attestation bundles were made for gitmsg_ai-0.2.2.tar.gz:
Publisher:
publish.yml on Weretik18/commit-msg-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitmsg_ai-0.2.2.tar.gz -
Subject digest:
2ac2ac8eb585933558af6a7fe6cc82052babf037c11be0f361c944214a883976 - Sigstore transparency entry: 1686452079
- Sigstore integration time:
-
Permalink:
Weretik18/commit-msg-ai@f786ce80115be2bb2e7728cbd848971c6fa5006b -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/Weretik18
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f786ce80115be2bb2e7728cbd848971c6fa5006b -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitmsg_ai-0.2.2-py3-none-any.whl.
File metadata
- Download URL: gitmsg_ai-0.2.2-py3-none-any.whl
- Upload date:
- Size: 14.6 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 |
d2188fbeaa6eae36aac74cfd26945aebbea9217f48480d22cfe2fad15522ba44
|
|
| MD5 |
6cdca45e21ed04c7dd30d891cb7acfac
|
|
| BLAKE2b-256 |
d8f8641da8da58521c0666c6579a1d8e72d0ba36f12043ae65ee21b3b5a27acb
|
Provenance
The following attestation bundles were made for gitmsg_ai-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on Weretik18/commit-msg-ai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitmsg_ai-0.2.2-py3-none-any.whl -
Subject digest:
d2188fbeaa6eae36aac74cfd26945aebbea9217f48480d22cfe2fad15522ba44 - Sigstore transparency entry: 1686452176
- Sigstore integration time:
-
Permalink:
Weretik18/commit-msg-ai@f786ce80115be2bb2e7728cbd848971c6fa5006b -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/Weretik18
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f786ce80115be2bb2e7728cbd848971c6fa5006b -
Trigger Event:
push
-
Statement type: