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.

asciicast

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 (POSIX sh):

export OPENAI_API_KEY="sk-..."

Note (fish): In fish, set it as follows.

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.1.tar.gz (10.9 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.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_commit_message-0.5.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_commit_message-0.5.1.tar.gz
Algorithm Hash digest
SHA256 e1a1c5639cf3f6d4bf87d948eee9c71a51e87427ca7daf457a9d819dace8c9b4
MD5 9a87b0274dc4f81320ca7e53425a00bb
BLAKE2b-256 b6d798e8024ef0a96448492c58180766d2abec1f438dc6b5e430eb9bdf3963bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_commit_message-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_commit_message-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e995613c8fe489ba099d5f194004b3e838b00c660dc8ed8506d7edb591998977
MD5 2354812767a4a053abbb663eba311634
BLAKE2b-256 1f1f334701be314fa3f4d3413494863d30305510a5145aee9c0357909a35a6ee

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