Skip to content

AI-powered commit message generator that analyzes your git diff and suggests meaningful commit messages.

License

Notifications You must be signed in to change notification settings

klokie/git-smart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git AI Commit

AI-powered commit message generator that analyzes your git diff and suggests meaningful commit messages.

The script will:

  1. Get the git diff of staged changes
  2. Send the diff to OpenAI API
  3. Generate a commit message
  4. Let you accept/reject/edit the suggested message

Requirements

  • Python 3.8+
  • OpenAI API key
  • Git installed and configured

Environment Variables

Create a .env file with your OpenAI API key:

OPENAI_API_KEY=sk-your-api-key-here

This key should start with sk- and can be generated in your OpenAI dashboard.

Installation

  1. Clone the repo
git clone https://github.com/klokie/git-smart
  1. Install dependencies
pip install .
  1. Set up environment variables
cp .env.example .env
  1. Add your OpenAI API key to .env

  2. Show usage

git_smart

Usage

Get commit message for staged changes:

git diff --staged | git_smart

Or for all changes since last commit:

git diff HEAD | git_smart

You can also provide the diff text directly:

git_smart "diff --git a/file.txt b/file.txt ..."

Make an alias in your .zshrc or .shrc:

alias gac="git diff --staged | git_smart"

License

This project is open-sourced under the MIT License - see the LICENSE file for details.

About

AI-powered commit message generator that analyzes your git diff and suggests meaningful commit messages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages