Skip to main content

AI-powered git commit message generator with local and cloud support

Project description

CommitGen Banner

PyPI version License: MIT Python 3.8+ Ollama OpenRouter

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

  1. 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.
  2. Stage Your Changes:

    git add .
    
  3. Generate a Commit:

    commitgen commit
    

    Review 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 --auto flag.

    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

Sourav Tripathy

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

commitgen_ai-0.1.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

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

commitgen_ai-0.1.2-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

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

Hashes for commitgen_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c393323c5e3b9a5e673f2fa53380ab5fa91f78dd4b65a22ab5c3c168b0f553bf
MD5 234208f4b0e3ca105a2399f0c691e3e0
BLAKE2b-256 8dd46b447e2e299fb273865322ac1dcc11c5591829fae439b54b57295dd65b84

See more details on using hashes here.

Provenance

The following attestation bundles were made for commitgen_ai-0.1.2.tar.gz:

Publisher: publish.yml on Sourav-Tripathy/commitgen

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

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

Hashes for commitgen_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c55fe8aa36dcaf534c40b6bb9eda2cc07f04c3a69c1a95795443b429b7a5b50
MD5 e81c83fb9f80179c0fbb5927fc73522c
BLAKE2b-256 c0995682d980aad8de7bd4967d7c006cb55830bfe80b520b1cf8251de35dfb16

See more details on using hashes here.

Provenance

The following attestation bundles were made for commitgen_ai-0.1.2-py3-none-any.whl:

Publisher: publish.yml on Sourav-Tripathy/commitgen

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