GitAI is a Go-based command-line tool that uses AI to automatically generate meaningful commit messages for your Git repositories.
- Automatically detects changes in your Git repository
- Generates commit messages using the Groq API with LLaMA 3.1 70B model on Groq
- Follows Conventional Commits format for generated messages
- Handles both staged and unstaged changes, including new files
- Allows user confirmation before committing changes
- Allows amending last commit if needed
- Go 1.23.0 or higher
- Git installed and configured on your system
- A Groq API key
-
Clone the repository:
git clone https://github.com/arunsathiya/gitai.git
-
Change to the project directory:
cd gitai
-
Install dependencies:
go mod download
-
Build the project:
go build
-
Create a
.gitai.env
file in your home directory:touch ~/.gitai.env
-
Add your Groq API key to the
.gitai.env
file:GROQ_API_KEY=your_api_key_here
Run the GitAI tool from your Git repository:
/path/to/gitai
The tool will:
- Detect changes in your repository
- Generate a commit message using AI
- Show you the generated message and ask for confirmation
- If confirmed, stage all changes and create a commit with the generated message
- GitAI uses the go-git library to interact with your Git repository.
- It generates a diff of the changes in your working directory.
- The diff is sent to the Groq API, which uses a large language model to generate a commit message.
- The generated message is presented to you for confirmation.
- If you approve, GitAI stages all changes and creates a commit with the generated message.
Contributions are welcome! Please feel free to submit a Pull Request.
This tool uses AI to generate commit messages. While it aims to produce meaningful and accurate messages, always review the generated messages before confirming the commit to ensure they accurately represent your changes.