AI-powered git commit message generator with local and cloud support
Project description
CommitGen is an CLI tool that automatically generates conventional git commit messages for your staged changes. It analyzes your git diff, summarizes the changes, and uses local LLMs (via Ollama) or cloud providers (via OpenRouter) to write clean, descriptive commit messages.
Features
- LLM-Powered: Uses advanced LLMs to understand your code changes.
- Local First: First-class support for Ollama models (Llama 3, DeepSeek, Phi-3, etc.).
- Cloud Option: Supports OpenRouter for access to top-tier models (GPT-4, Claude 3.5, Llama 3.1 405B) and free models.
- Smart Handling:
- Automatically starts Ollama if it's not running.
- Smart chunking for large diffs to fit within context windows of smaller models (1B-3B parameters).
- CPU fallback for low-VRAM systems.
- Configurable: Easy-to-use CLI for configuration management.
- Conventional Commits: Generates messages following the Conventional Commits specification by default.
Installation
Prerequisites
- Python 3.8+
- Git
- Ollama (optional, for local models)
Install from PyPI
pip install commitgen-ai
Install from Source
git clone https://github.com/souravtripathy/commitgen.git
cd commitgen
pip install -e .
Quick Start
-
Initialize Configuration: Run the interactive setup wizard to choose your provider and model.
commitgen init- Ollama: It will detect installed models or help you download a starter model (
llama3.2:1b). - OpenRouter: You'll need an API key from openrouter.ai.
- Ollama: It will detect installed models or help you download a starter model (
-
Stage Your Changes:
git add .
-
Generate a Commit:
commitgen commitReview the generated message and confirm to commit!
Configuration
Manage your settings easily with the config command.
View Configuration
commitgen config
# Or get specific value
commitgen config --get ollama.model
Change Defaults
# Swith to a different Ollama model
commitgen config --set ollama.model=deepseek-r1:1.5b
# Change OpenRouter model
commitgen config --set openrouter.model=google/gemma-2-27b-it:free
Reset Configuration
If you want to restore default settings:
commitgen config --reset
Usage Tips
-
Auto-Commit: Skip confirmation with
--autoflag.commitgen commit --auto
-
Override Model: Use a specific model for just one commit.
commitgen commit --model qwen2.5:0.5b
-
Ollama Upgrade: If your local model is failing due to memory, CommitGen will automatically try to run it on CPU.
License
MIT License - see LICENSE file
Author
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 commitgen_ai-0.1.2.tar.gz.
File metadata
- Download URL: commitgen_ai-0.1.2.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c393323c5e3b9a5e673f2fa53380ab5fa91f78dd4b65a22ab5c3c168b0f553bf
|
|
| MD5 |
234208f4b0e3ca105a2399f0c691e3e0
|
|
| BLAKE2b-256 |
8dd46b447e2e299fb273865322ac1dcc11c5591829fae439b54b57295dd65b84
|
Provenance
The following attestation bundles were made for commitgen_ai-0.1.2.tar.gz:
Publisher:
publish.yml on Sourav-Tripathy/commitgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commitgen_ai-0.1.2.tar.gz -
Subject digest:
c393323c5e3b9a5e673f2fa53380ab5fa91f78dd4b65a22ab5c3c168b0f553bf - Sigstore transparency entry: 940777125
- Sigstore integration time:
-
Permalink:
Sourav-Tripathy/commitgen@5ce145f4b7298e07e630a381dcef8fe7d51a88c7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Sourav-Tripathy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ce145f4b7298e07e630a381dcef8fe7d51a88c7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file commitgen_ai-0.1.2-py3-none-any.whl.
File metadata
- Download URL: commitgen_ai-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c55fe8aa36dcaf534c40b6bb9eda2cc07f04c3a69c1a95795443b429b7a5b50
|
|
| MD5 |
e81c83fb9f80179c0fbb5927fc73522c
|
|
| BLAKE2b-256 |
c0995682d980aad8de7bd4967d7c006cb55830bfe80b520b1cf8251de35dfb16
|
Provenance
The following attestation bundles were made for commitgen_ai-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on Sourav-Tripathy/commitgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commitgen_ai-0.1.2-py3-none-any.whl -
Subject digest:
5c55fe8aa36dcaf534c40b6bb9eda2cc07f04c3a69c1a95795443b429b7a5b50 - Sigstore transparency entry: 940777165
- Sigstore integration time:
-
Permalink:
Sourav-Tripathy/commitgen@5ce145f4b7298e07e630a381dcef8fe7d51a88c7 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Sourav-Tripathy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5ce145f4b7298e07e630a381dcef8fe7d51a88c7 -
Trigger Event:
release
-
Statement type: