#commit-message #git-commit #git-hook #chatgpt #ai #generation #automate

bin+lib git-ai

Git AI: Automates commit messages using ChatGPT. Stage your files, and Git AI generates the messages.

20 releases

0.1.29 Mar 19, 2024
0.1.28 Mar 19, 2024
0.1.19 Jan 10, 2024
0.1.18 Dec 24, 2023

#135 in Machine learning

Download history 39/week @ 2023-12-18 1/week @ 2023-12-25 20/week @ 2024-01-08 3/week @ 2024-02-26 154/week @ 2024-03-04 26/week @ 2024-03-11 924/week @ 2024-03-18 511/week @ 2024-04-01

1,467 downloads per month

MIT license

110KB
1K SLoC

Git AI Rust Crates.io License

Git AI seamlessly integrates ChatGPT with git hooks to automate commit message generation based on your staged files. Stage your changes and commit without a message; Git AI does the rest, crafting detailed commit messages that reflect the essence of your changes.

Key Features

  • Smart Integration: Leverages OpenAI's powerful Assistant API, expertly tailored to transform git diffs into insightful commit messages.
  • Contextual Learning: This feature maintains a dedicated thread for each project, allowing the assistant to build context over time and thereby improving performance and message relevance with every commit.
  • Local Optimization: Hosts an exclusive assistant instance on your machine, learning from all your projects to elevate the quality of commit messages throughout your development environment.

Quick Start

# Install Git AI
cargo install git-ai

# Set your OpenAI API key
git-ai config set openai-api-key <your key>

# Install the Git AI hook in your repo
git-ai hook install

# Make your changes, stage them, and commit without a message
git commit --all --no-edit

Getting Started

Prerequisites

  • Rust and Cargo installed on your machine.

Installation Options

Via Crates.io

cargo install git-ai
git-ai config set openai-api-key <api-key>
git-ai hook install

From Source

git clone https://github.com/oleander/git-ai
cd git-ai
cargo install --path .

Usage Guide

Setting Up

  • Follow the installation instructions to get Git AI ready.
  • Initialize Git AI in your repository with git-ai hook install.
  • Set your OpenAI API key using git-ai config set openai-api-key <api-key>.

Advanced Configuration

Customize Git AI's behavior with these commands:

  • git-ai config set max-tokens <max-tokens>: Adjust the git diff character limit.
  • git-ai config set timeout <timeout>: Set OpenAI response timeout.
  • git-ai config set language <language>: Select the model language (default: en).

Contributing

Your feedback and contributions are welcome! Join our community to help improve Git AIby submitting issues, offering suggestions, or contributing code. See our contributing guidelines for more details.

Testing

Run cargo test to execute the test suite and ensure everything functions as expected.

License

Git AI is proudly open-sourced under the MIT License. See LICENSE for more details.

Dependencies

~28–44MB
~781K SLoC