Skip to main content

AI-generated Conventional Commit messages from your staged Git diff. Local (Ollama) or cloud (OpenAI).

Project description

gitmsg-ai

CI PyPI version Python versions Downloads License: MIT

AI-generated Conventional Commit messages from your staged Git diff.

Works with local models via Ollama (free, private) or OpenAI (paid).

📦 Previously published as commit-msg-ai. Both CLI commands (gitmsg-ai and commit-msg-ai) work for backwards compatibility.

Features

  • Conventional Commitsfeat, 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 gitmsg-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.yaml to use that model
Stage changes and run:

git add .

gitmsg-ai
Usage
undefined
Default: generate one commit message
gitmsg-ai

With emoji
gitmsg-ai --emoji

Pick from 3 options
gitmsg-ai --interactive

In Russian
gitmsg-ai --lang ru

Regenerate for last commit (use with git commit --amend)
gitmsg-ai --amend

Skip cache (always call the model)
gitmsg-ai --no-cache

Subject line only, no body
gitmsg-ai --no-body

Pipe straight into git
gitmsg-ai | git commit -F -


## Git hook (automatic mode)

```bash

gitmsg-ai install-hook
Now every git commit will pre-fill the commit message editor with an AI-generated one.

To remove:


gitmsg-ai uninstall-hook
Commands
Command	What it does
gitmsg-ai	Generate a commit message
gitmsg-ai install-hook	Install prepare-commit-msg hook
gitmsg-ai uninstall-hook	Remove the hook
gitmsg-ai clear-cache	Delete all cached messages
gitmsg-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
undefined
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](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

gitmsg_ai-0.2.4.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitmsg_ai-0.2.4-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file gitmsg_ai-0.2.4.tar.gz.

File metadata

  • Download URL: gitmsg_ai-0.2.4.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitmsg_ai-0.2.4.tar.gz
Algorithm Hash digest
SHA256 3d1a7ba492f5d91469ad9ce2ad8bb668a9d5739c31e3e7834f0bbf15c1dc82fe
MD5 edaeae17e05f1fae0d566b83d689fa41
BLAKE2b-256 450e98cd2cd2f29cbef4501ad7f1e1ad8835dd8522d70524356c922eda1e13ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitmsg_ai-0.2.4.tar.gz:

Publisher: publish.yml on Weretik18/commit-msg-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitmsg_ai-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: gitmsg_ai-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitmsg_ai-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3a15051c86ab7faee3de7f47481617fd7e779e0aa9c863fc57dde4c28a8af1e9
MD5 4da2b31f6af39766ae2e63b11564bd5f
BLAKE2b-256 44205e74decb8d0b7a27a1ac1cf32647030a3948172070558fb3a4ec94dce96e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitmsg_ai-0.2.4-py3-none-any.whl:

Publisher: publish.yml on Weretik18/commit-msg-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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