Skip to main content

Generate Git commit messages from staged changes using OpenAI GPT

Project description

git-commit-message

Staged changes -> GPT commit message generator.

Install (PyPI)

Install the latest released version from PyPI:

# User environment (recommended)
python -m pip install --user git-commit-message

# Or system/virtualenv as appropriate
python -m pip install git-commit-message

# Or with pipx for isolated CLI installs
pipx install git-commit-message

# Upgrade to the newest version
python -m pip install --upgrade git-commit-message

Quick check:

git-commit-message --help

Set your API key (fish):

set -x OPENAI_API_KEY "sk-..."

Install (editable)

python -m pip install -e .

Usage

  • Print commit message only:
git add -A
git-commit-message "optional extra context about the change"
  • Force single-line subject only:
git-commit-message --one-line "optional context"
  • Limit subject length (default 72):
git-commit-message --one-line --max-length 50 "optional context"
  • Commit immediately with editor:
git-commit-message --commit --edit "refactor parser for speed"
  • Select output language/locale (default: en-GB):
# American English
git-commit-message --language en-US "optional context"

# Korean
git-commit-message --language ko-KR

# Japanese
git-commit-message --language ja-JP

Notes:

  • The model is instructed to write using the selected language/locale.
  • In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.

Environment:

  • OPENAI_API_KEY: required
  • GIT_COMMIT_MESSAGE_MODEL or OPENAI_MODEL: optional (default: gpt-5-mini)
  • GIT_COMMIT_MESSAGE_LANGUAGE: optional (default: en-GB)

AI‑generated code notice

Parts of this project were created with assistance from AI tools (e.g. large language models). All AI‑assisted contributions were reviewed and adapted by maintainers before inclusion. If you need provenance for specific changes, please refer to the Git history and commit messages.

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

git_commit_message-0.5.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

git_commit_message-0.5.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file git_commit_message-0.5.0.tar.gz.

File metadata

  • Download URL: git_commit_message-0.5.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for git_commit_message-0.5.0.tar.gz
Algorithm Hash digest
SHA256 55785c7fc85a311a193990ffd5f596f0c6bd77a8a3d3233b7d437cd6269cd060
MD5 4c5ddfe41fe39beed4d0b8f56a524fc3
BLAKE2b-256 68d40014afbd23b25249334dcb049e2b91a6dea05cb945c03c0b41e75e84485a

See more details on using hashes here.

File details

Details for the file git_commit_message-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_commit_message-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e1a3e901100cbecdda14deb2b2c99fda1ff6e177e9db8117a994b1587f45f3c
MD5 f9ecec63ce9f902f229c8be05477fbd4
BLAKE2b-256 b1843c9953125b28c0eaa1c4005b47f144ecd852fbf3aee9328e5edc358bd3f3

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