Skip to main content

Generate Conventional Commit messages from your staged changes using an LLM

Project description

git-llm-commit

codecov

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

  1. Ensure you have Python 3.x installed
  2. Install the package:
    pip install git-llm-commit
    

Setup

  1. Get an OpenAI API key from OpenAI's platform
  2. Set your API key in your environment:
    export OPENAI_API_KEY='your-api-key'
    
    Or create a .env file in your project root with:
    OPENAI_API_KEY=your-api-key
    

Usage

  1. Stage your changes as usual:

    git add .
    
  2. Instead of git commit, run:

    git llm-commit
    
  3. Review the generated commit message and:

    • Press y to accept and commit
    • Press n to abort
    • Press e to edit the message before committing

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:

  • .env files
  • 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

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

git_llm_commit-1.1.0.tar.gz (33.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_llm_commit-1.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file git_llm_commit-1.1.0.tar.gz.

File metadata

  • Download URL: git_llm_commit-1.1.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.28

File hashes

Hashes for git_llm_commit-1.1.0.tar.gz
Algorithm Hash digest
SHA256 83ebc639c8b702a7650be2337cb9f6ed131a9ddc47e52004bbdc7c8f13d80b93
MD5 e8e56fa4823e5d57425f3bde6fb3881c
BLAKE2b-256 0dcc2d713b6029da889c2fe15a735cb08e67e7d2d558ea45df61b96cf4b64372

See more details on using hashes here.

File details

Details for the file git_llm_commit-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_llm_commit-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bec1b4b5587f8df3da3534a541399d7009724f5ce944d847ad436354ce911011
MD5 2b9deda9fea3d4eace51cd6b43b3dd91
BLAKE2b-256 f1172d40c15899de4f696c1a5bf2183123f3cb44b6fd7a617e5c7609e71d1eff

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