giton is AI-powered tool for Git.

Initialize your repo

$ giton init

Run some commands

$ giton add file.txt

Undo the previous command

$ giton undo
        ⣷ Communicating with Open AI
+---+------------------------------------------+
| # | Command                                  |
+==============================================+
| 0 | git restore --staged file.txt            |
+---+------------------------------------------+

:: Prooced with Command(s)?: [Y/n]
        

Table of Content


# Installation

You need git installed and accessible from your commandline.

# Pre-built Binaries

You can download the relevant binary from the latest release. Linux, macOS and Windows binaries are available for x86_64.

# Compilation with Cargo

If you have the rust toolchain installed, you can install giton with cargo

$ cargo install giton

# Configuration

You need an OpenAI API Key to be able to use giton. After creating an account with OpenAI, you can generate an API key. Then, you need to set this API key in your shell environment.

For Linux/macOS

export GITON_OPENAI_KEY=your_api_key

For Windows/Powershell

$env:GITON_OPENAI_KEY = "your_api_key"

# Commands

# History

giton stores your commands history in the file .giton in the root of your directory. It is recommended to track this file as it improves the accuracy of the undo and helpme commands.

Usage

giton history

Output

2023-12-13 20:01:45: status 
2023-12-20 00:56:03: add . 
2023-12-20 00:56:20: commit -m imp(display): add spinners

# Helpme

helpme uses your current repository context to suggest possible commands.

Usage

giton helpme

Output

⣷ Communicating with Open AI
+---+----------------------------------------------+
| # | Command                                      |
+==================================================+
| 0 | git add README.md                            |
|---+----------------------------------------------|
| 1 | git commit -m "chore(readme): update README" |
+---+----------------------------------------------+

:: Prooced with Command(s)?: [Y/n]

# Undo

undo uses giton stored history to suggest a command (or set of commands) that cancels out your previous command.

Usage

giton undo

Output

⣷ Communicating with Open AI 
+---+------------------------------------------+
| # | Command                                  |
+==============================================+
| 0 | git restore --staged core/src/command.rs |
+---+------------------------------------------+

:: Prooced with Command(s)?: [Y/n]

# GPT-4 Costs

GPT-4 is not free and can actually be pricey. Only the helpme and undo commands make calls to GPT-4; all other commands (including git passthrough commands) do not make calls to GPT-4.

It is hard to estimate the cost of GPT-4 calls. I recommend you frequently check the usage tab in the Open AI dashboard to get an idea of the cost; and adjust your consumption accordingly.


# Vulnerability reporting

For reporting a security vulnerability, you can directly send me an email.


# License

giton is distributed under the MIT License.

See LICENSE for details.