Git Commit Analyzer is a powerful Git plugin that leverages AI to automatically generate meaningful commit messages based on your staged changes. It supports both local (Ollama) and remote AI models to analyze git diffs and propose commit messages following the Git Flow format.
- Automatic generation of Git Flow compliant commit messages
- Support for multiple AI providers (Ollama and Groq and Cerebras)
- Interactive mode allowing users to choose AI provider, use, edit, or cancel the proposed commit message
- Cross-platform compatibility (Linux, macOS, Windows)
- Customizable with your personal Git signature
- Git (version 2.0 or later)
- Rust (version 1.54 or later)
- Cargo (usually comes with Rust)
- Ollama (with llama3.1 model installed) for local AI processing
- Groq API key (optional, for using Groq's remote AI model)
- Cerebras API key (optional, for using Cerebras' remote AI model)
-
Clone the repository:
git clone https://github.com/zh30/git-commit-analyzer.git cd git-commit-analyzer
-
Build the project:
cargo build --release
-
Create a directory for Git plugins (if it doesn't exist):
mkdir -p ~/.git-plugins
-
Copy the compiled binary to the plugins directory:
cp target/release/git-ca ~/.git-plugins/
-
Add the plugins directory to your PATH. Add the following line to your
~/.bashrc
,~/.bash_profile
, or~/.zshrc
(depending on your shell):export PATH="$HOME/.git-plugins:$PATH"
-
Reload your shell configuration:
source ~/.bashrc # or ~/.bash_profile, or ~/.zshrc
-
If you plan to use Groq, set up the API key as an environment variable:
echo 'export GROQ_API_KEY=your_groq_api_key_here' >> ~/.bashrc # or ~/.bash_profile, or ~/.zshrc echo 'export CEREBRAS_API_KEY=your_cerebras_api_key_here' >> ~/.bashrc # or ~/.bash_profile, or ~/.zshrc source ~/.bashrc # or ~/.bash_profile, or ~/.zshrc
-
Clone the repository:
git clone https://github.com/zh30/git-commit-analyzer.git cd git-commit-analyzer
-
Build the project:
cargo build --release
-
Create a directory for Git plugins (if it doesn't exist):
mkdir %USERPROFILE%\.git-plugins
-
Copy the compiled binary to the plugins directory:
copy target\release\git-commit-analyzer.exe %USERPROFILE%\.git-plugins\
-
Add the plugins directory to your PATH:
- Right-click on 'This PC' or 'My Computer' and select 'Properties'
- Click on 'Advanced system settings'
- Click on 'Environment Variables'
- Under 'System variables', find and select 'Path', then click 'Edit'
- Click 'New' and add
%USERPROFILE%\.git-plugins
- Click 'OK' to close all dialogs
-
If you plan to use Groq, set up the API key as an environment variable:
- In the same 'Environment Variables' dialog, under 'User variables', click 'New'
- Set Variable name as
GROQ_API_KEY
and Variable value as your Groq API key - Set Variable name as
CEREBRAS_API_KEY
and Variable value as your Cerebras API key - Click 'OK' to close all dialogs
-
Restart any open command prompts for the changes to take effect.
After installation, you can use Git Commit Analyzer in any Git repository:
-
Stage your changes in your Git repository (using the
git add
command). -
Run the following command:
git ca
-
Follow the prompts to select an AI provider (Ollama or Groq).
-
The program will analyze your staged changes and generate a suggested commit message.
-
You can choose to use the suggested message, edit it, or cancel the commit.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- The Rust community for providing excellent libraries and tools
- Ollama for providing the llama3.1 model
- Groq for their API service