mms-gianni / GitGenie

💡GitGenie is a git plugin that creates commit messages with ChatGPT.
GNU General Public License v3.0
7 stars 0 forks source link
ai chatgpt cli developer-tools development git git-plugin github terminal

GitGenie

Go Report Card GoDoc GitHub release GitHub license

Once upon a time, there was a magical genie who lived inside Git as a plugin. This genie loved to help developers write better commit messages when they changed their code.

The genie was very clever and used its magic ChatGPT powers to analyze the changes in the code and suggest good messages for the developers to use.

And if the developers weren't happy with any of the suggestions, he would open an editor and give them the opportunity to adjust the suggestions to their liking.

Note The genie needs your help: There are binaries for Linux and Windows (ARM and x86_64). I have only a Mac(x86_64) to test the binaries. If you have a Windows/Linux or ARM architecture please let me know in the issues section if it works.

Usage

git add . 
git gci 
git gci [flags]

Flags:
  -d, --debug                Print debug information
  -f, --fast                 Skip editing the commit message
  -h, --help                 help for git
  -H, --host string          OpenAI API host (default "api.openai.com")
  -L, --language string      Commit message language: en, ch, de, es, fr, it, ja, ko, pt, zh (default "en")
  -l, --length string        Commit message length: short, medium, long, verylong (default "medium")
  -s, --signoff              Add signing signature to commit message
  -n, --suggestions string   Number of suggestions to generate (default "3")
  -v, --version              version for git

Installation

Download the binary for you operating system from the releases page and extract it to /usr/local/bin or any other directory in your PATH.

tar -xvzf GitGenie_Mac_x86_64.tar.gz -C /usr/local/bin

export OPENAI_API_KEY=sk-y..............................

Add the OpenAI Key ENV to your .bashrc or .zshrc and configure your Genie with the following additional ENV variables to change the default behavior.

Privacy

There may be many reasons a repository owner does not want to allow genie generated commit messages or code to be sent to a third party service. For this reason, the repository can be configured to block GitGenie completly.

To block the genie, create a file called .gitgenieblock in the root of your repository and add the following content:

echo "https://github.com/kubero-dev/GitGenie" > .gitgenieblock

Repository Configuration (optional)

Prepare your repository for GitGenie by adding a .gitgenie file to the root of your repository. This file can be used to configure the genie for your repository.

Parameters:

Examples

Create a commit message with 5 suggestions and skip editing the commit message

git gci -n 5 -f

Create a commit message in a different language and use a short commit message

git gci -L de -l short