Skip to main content

Generate git commit using AI

Project description

git-diff-lm

A command-line tool that uses OpenAI's language models to automatically generate meaningful git commit messages from staged changes.

Features

  • Analyzes git diff output using OpenAI's GPT models
  • Generates concise, descriptive commit messages
  • Detects and alerts about sensitive information in diffs
  • Allows editing of suggested commit messages before committing
  • Securely stores API credentials

Installation

  1. Clone this repository
  2. Install dependencies:
pip install -r requirements.txt

Setup

On first run, you'll be prompted to enter:

  • Your OpenAI API key
  • OpenAI Base URL (optional, defaults to standard OpenAI API endpoint)

Usage

  1. Stage your changes using git add
  2. Run the tool:
komitai

To update stored credentials:

komitai -u

How it Works

  1. Retrieves staged changes using git diff --staged
  2. Sends diff to OpenAI API with specific prompting
  3. Analyzes changes and generates appropriate commit message
  4. Allows user review/editing before committing
  5. Executes the commit with the approved message

Security Features

  • Scans for sensitive information in diffs
  • Alerts user if potential credentials are detected
  • Stores API keys securely in user config directory
  • Includes .env in .gitignore

Requirements

  • Python 3.6+
  • Git
  • OpenAI API key
  • Required Python packages listed in requirements.txt

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

komitai-0.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

komitai-0.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file komitai-0.0.2.tar.gz.

File metadata

  • Download URL: komitai-0.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.12

File hashes

Hashes for komitai-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6852e7759bf6f9fd523681bd92bd6fb5dee10a57dfda6d29d32daa4fdc972f78
MD5 064291906978ee6df26c0d4d76bd24d8
BLAKE2b-256 82414ec78f34b5bb72e43ddfa8d8d217d836e4b2c3d2c3e6b5b606d48b50a305

See more details on using hashes here.

File details

Details for the file komitai-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: komitai-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.12

File hashes

Hashes for komitai-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48ce2b7fb09bfcf3a32b1f63a4fdc5ead9369a42fc9ee7a71f7f9b23b3b6a31e
MD5 80bc34e3a9ffc0719f274bc6f695fb97
BLAKE2b-256 afd344520741b9382aa71e0c31104c3581851301a86b3bf1cc06c428eb7b1229

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