Skip to main content

Generate commit messages with AI (Google Gemini) automatically using `git diff`.

Project description

commitmessagegenerator

Generate objective and technical commit messages with AI (Google Gemini) automatically using your git diff.

📦 Install

pip install commitmessagegenerator

Or, if you're using a venv:

python -m venv venv
source venv/bin/activate  # or .\venv\Scripts\activate in Windows
pip install commitmessagegenerator

⚙️ Configuring

commitgen -cf

This will prompt you for:

  1. Your Gemini API key
  2. Your preferred AI model (with options to choose from)

Run this and type you API key to the terminal so the package creates the .env file and automatically adds it to the .gitignore

Or do it manually:

IMPORTANT - BEFORE CREATING THIS FILE ADD '.venv' TO YOUR .gitignore SO YOUR API KEY ISN'T EXPOSED

Create a .env file in the directory where you will run commitgen (usually the root of your Git project):

GEMINI_API_KEY=your-gemini-api-key
AI_MODEL=gemini-2.0-flash

🚀 Usage

With the terminal, inside any Git repository with pending changes, run:

commitgen (-c/-cp)

The command will:

  • Read the git diff;
  • Send it to the Google Gemini API using your configured model;
  • Return a commit message suggestion directly in your terminal.

Available Commands

  • commitgen - Generate commit message only
  • commitgen -c - Generate and commit with the message
  • commitgen -cp - Generate, commit, and push
  • commitgen -cf - Configure API key and model
  • commitgen -s - Show current configuration status

Available Models

When configuring with -cf, you can choose from:

  1. gemini-2.0-flash (default) - Fast and efficient
  2. gemini-1.5-flash - Good balance of speed and quality
  3. gemini-1.5-pro - Highest quality, slower
  4. gemini-2.0-flash-exp - Experimental version
  5. gemini-2.5-flash - Latest version, fast and efficient
  6. gemini-2.5-pro - Latest version, highest quality

🧩 Requisites

  • Python 3.8 or higher
  • Gemini API Key (Google Generative AI, free at: https://aistudio.google.com/app/apikey)
  • Initialized Git repository
  • Python dependencies (Automatically installed with the package):
    • GitPython
    • google-generativeai
    • python-dotenv

📄 License

MIT License

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

commitmessagegenerator-1.6.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

commitmessagegenerator-1.6.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file commitmessagegenerator-1.6.0.tar.gz.

File metadata

  • Download URL: commitmessagegenerator-1.6.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for commitmessagegenerator-1.6.0.tar.gz
Algorithm Hash digest
SHA256 20cfdee87886cdc5dac222f79996d5abffc582c635e6ed926e1b21827201fef4
MD5 95b4286c9c72c668a43752cb4dee4a35
BLAKE2b-256 952c5ad0793aab37a0484111c49f8106def6748d55e06560f04146c82427f044

See more details on using hashes here.

File details

Details for the file commitmessagegenerator-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for commitmessagegenerator-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5831a28a4a06263ed81eafe8f1bbcea55237f4da8aec56376d823b8771a6fb2
MD5 e9c7cf9eb9a6bad5f91f2dac3c3e3b0b
BLAKE2b-256 45df5d4fda6d955fe34e8738818789e920398953c4212462d5f670e97dd285db

See more details on using hashes here.

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