Skip to main content

Generate Git commit messages using an OpenAI-compatible API

Project description

Gommit

A Python tool to generate Git commit messages for staged changes using an OpenAI-compatible API. Installation From PyPI:

pip install gommit

Requirements

  • Python 3.6
  • Git installed and accessible in PATH
  • OpenAI API key set as an environment variable (OPENAI_API_KEY)

Environment Variables Set the following environment variables in your ~/.bashrc or ~/.zshrc for persistence:

export OPENAI_API_KEY=your-api-key-here
export OPENAI_BASE_URL=https://api.openai.com/v1  # Optional, defaults to OpenAI API
export OPENAI_MODEL=gpt-4o-mini                   # Optional, defaults to gpt-4o-mini

Add them and reload your shell:

echo 'export OPENAI_API_KEY=your-api-key-here' >> ~/.bashrc
echo 'export OPENAI_BASE_URL=https://api.openai.com/v1' >> ~/.bashrc
echo 'export OPENAI_MODEL=gpt-4o-mini' >> ~/.bashrc
source ~/.bashrc

Usage

Stage your changes in a Git repository: git add .

Run the gommit

Review the generated commit message and choose to commit (y) or abort (n).

Project-specific configuration – gommit.ini

Create a file named gommit.ini in the root of your repository:

[gommit]
# short (default) or descriptive
message_style = short

# true / false  (default false)
use_emojis = false

# Optional – override global env vars for this project only
# api_key = sk-...
# base_url = https://my-self-hosted-api/v1
# model = gpt-4o-mini

Notes

  • The script uses git diff --cached to read only staged changes.
  • Customize the API endpoint or model via OPENAI_BASE_URL and OPENAI_MODEL environment variables.
  • Ensure your Git repository is properly initialized before running.

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

gommit-0.4.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

gommit-0.4.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file gommit-0.4.1.tar.gz.

File metadata

  • Download URL: gommit-0.4.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gommit-0.4.1.tar.gz
Algorithm Hash digest
SHA256 16fdefd85dead45fc58e51c92f66eb5e05ce7799908424a0f3c52500d7076fc5
MD5 69105da683c8868c3ab0f81559acebe7
BLAKE2b-256 5a0837b51cacc6eab803e6dbf115b60ee94b929a03bdf1085173034b65a54e61

See more details on using hashes here.

File details

Details for the file gommit-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: gommit-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gommit-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 285553169d54d4df2567054c322725b44f342921e4eee9fd6cf8f627a360ea20
MD5 3262b36654b0015c69addbe12dd6ff92
BLAKE2b-256 4b58c4a16f73f053a81d82618ebe72e109d10ee363e90431d384e14739fd0f85

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