Generate Conventional Commit messages from your staged changes using an LLM
Project description
git-llm-commit
Generate Conventional Commit messages from your staged changes using an LLM (GPT-4).
Description
git-llm-commit is a command-line tool that analyzes your staged git changes and generates a commit message following the Conventional Commits specification using OpenAI's GPT-4 model.
Installation
- Ensure you have Python 3.x installed
- Install the package:
pip install git-llm-commit
Setup
-
Get an OpenAI API key from OpenAI's platform
-
Set your API key in your environment:
export OPENAI_API_KEY='your-api-key'
Or create a
.envfile in your project root with:OPENAI_API_KEY=your-api-key -
(Optional) Customize the LLM's creativity:
export LLM_COMMIT_TEMPERATURE='0.5' # More deterministic (0.0-1.0, default: 0.7)
Or in your
.envfile:LLM_COMMIT_TEMPERATURE=0.5
Usage
-
Stage your changes as usual:
git add .
-
Instead of
git commit, run:git llm-commit -
Review the generated commit message and:
- Press
yto accept and commit - Press
nto abort - Press
eto edit the message before committing
- Press
Features
- Generates commit messages following Conventional Commits format
- Uses GPT-4 to analyze diffs and create meaningful commit messages
- Adapts commit message detail based on change size:
- Small changes (≤50 lines): Concise, single-line messages
- Medium changes (51-200 lines): Moderate detail with brief body
- Large changes (>200 lines): Detailed messages with full body and footers
- Supports interactive editing of generated messages
- Integrates with your default git editor
- Respects conventional commit types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
- Detects potentially risky files (like .env, credentials, secrets) and prompts for confirmation before committing
Security Features
Risky File Detection
The tool automatically scans staged files for potentially sensitive content like:
.envfiles- Files containing "secret" or "credentials" in the name
- Key files
- Secret/credential configuration files (yml, yaml, json, toml)
If such files are detected, you'll be prompted for confirmation before proceeding with the commit. This helps prevent accidental commits of sensitive information to your repository.
Requirements
- Python 3.x
- Git
- OpenAI API key
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_llm_commit-1.2.1.tar.gz.
File metadata
- Download URL: git_llm_commit-1.2.1.tar.gz
- Upload date:
- Size: 41.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2fc12dc8fb0d6712b7c5c69b2aef3d18606db4a664a3901bedf96877bd0bd76
|
|
| MD5 |
abc1e2c61a794d896177d3c2c60f1a11
|
|
| BLAKE2b-256 |
a2eb9ab19c9a81b770d505db13a1d8b08f716886032796fc3808b9758efcfae6
|
File details
Details for the file git_llm_commit-1.2.1-py3-none-any.whl.
File metadata
- Download URL: git_llm_commit-1.2.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43ec27e5bac46d1e40bda9ac55fb953fd5250a5686529426a6df3c21924e1aef
|
|
| MD5 |
c49549710f8a2ace7cbf9f2f36a42355
|
|
| BLAKE2b-256 |
06d27110cf1a18ba9198f5c6fb3fc5b7a8d13d4b35da00c217a76ef7a5a5c637
|