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:
commit-ai

To update stored credentials:

commit-ai -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.1.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.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: komitai-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 13e2d11e41ce318fa61c2fa872280b2ddfb7eadf10486ca2c5822d35f84c4fe6
MD5 124ca63d47e28fd712e89dd5aa03b3e7
BLAKE2b-256 dd537f2f844958b3a56f8914eadf7f93ae40c7d57e7386889269bc10a3fbd22e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: komitai-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7113a04888bbe37872438e895431c20dc5fba6cf2c0496f9a106440284dd66fa
MD5 f74d7688bf07f540f0f57266318c43c1
BLAKE2b-256 9d734fe7ee3d7b1e7c08364f000dcdd39107df365c3900ec539b93fcc808fb0c

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