GitR (pronounced as Gitter) is a command-line tool that uses AI to generate conventional commit messages based on your staged changes. It integrates seamlessly with your Git workflow and provides an interactive interface for reviewing and editing generated messages.
(All commit messages to this project are generated by GitR)
- AI-Powered: Uses OpenAI-compatible APIs to generate intelligent commit messages
- Conventional Commits: Follows conventional commit message standards
- Fast Workflow: Quick commit generation with optional confirmation
- Configurable: Customizable settings for different models and preferences
- Smart Parsing: Automatically extracts clean commit messages from AI responses
- Safe: Always shows generated messages before committing
- Flexible: Multiple usage modes for different workflows
- Go 1.21 or later
- Git repository
- OpenAI API key (or compatible API like Shivaay)
Linux/macOS:
git clone <repository-url>
cd gitr
chmod +x install.sh
./install.shWindows (PowerShell as Administrator):
git clone <repository-url>
cd gitr
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\install.ps1Linux/macOS:
git clone <repository-url>
cd gitr
make installFor current user only (no sudo required):
make install-usergit clone <repository-url>
cd gitr
go build -o gitr .
# Install system-wide (requires sudo on Unix)
sudo cp gitr /usr/local/bin/
sudo chmod +x /usr/local/bin/gitr
# Or install for current user
mkdir -p ~/bin
cp gitr ~/bin/
chmod +x ~/bin/gitr
# Make sure ~/bin is in your PATHAfter installation, verify GitR is working:
gitr --helpYou should see the help message. If you get "command not found", make sure the installation directory is in your PATH.
Linux/macOS:
sudo rm /usr/local/bin/gitr
# Or if installed for user only:
rm ~/bin/gitrWindows:
# Remove from Program Files
Remove-Item -Recurse -Force "$env:ProgramFiles\GitR"
# Remove from PATH (requires manual editing of system environment variables)Run GitR for the first time to set up your configuration:
gitrThis will guide you through:
- Setting up your API key
- Configuring your preferred model
- Setting commit message preferences
GitR supports multiple AI providers:
- Base URL:
https://api.openai.com/v1 - Models:
gpt-3.5-turbo,gpt-4, etc. - Get API Key: OpenAI Platform
- Base URL:
https://api.futurixai.com/api/shivaay/v1 - Model:
shivaay - Get API Key: Shivaay Documentation
- Documentation: Shivaay API Docs
GitR works with any OpenAI-compatible API endpoint. Simply configure the base URL and model name in your settings.
# Generate and display commit message
gitr
# Generate message and commit with confirmation
gitr -c
# Generate message and commit without confirmation
gitr -c -b
# Edit configuration
gitr config| Option | Description |
|---|---|
gitr |
Generate and display commit message |
gitr -c, --commit |
Generate message and commit with confirmation |
gitr -c -b, --bypass |
Generate message and commit without confirmation |
gitr --help, -h |
Show help information |
gitr config |
Open configuration editor |
# Just generate a commit message
gitr
# Commit with interactive confirmation
gitr -c
# Quick commit without confirmation
gitr -c -b
# Edit your settings
gitr config
# Show help
gitr --helpGitR looks for configuration files in the following order:
.gitr_configin current directory~/.gitr_configin home directory~/.config/gitr/configin standard config location
- API Key: Your API key from your chosen provider
- Base URL: API endpoint
- OpenAI:
https://api.openai.com/v1 - Shivaay:
https://api.futurixai.com/api/shivaay/v1
- OpenAI:
- Model: Model to use
- OpenAI:
gpt-3.5-turbo,gpt-4, etc. - Shivaay:
shivaay
- OpenAI:
- Max Tokens: Maximum response length
- Temperature: Response creativity (0.0-2.0)
- Timeout: Request timeout in seconds
- Style: Commit message style (conventional, simple, etc.)
- Max Length: Maximum commit message length
- Include Scope: Whether to include scope in commit messages
- Commit Without Confirmation: Default behavior for commits
<?xml version="1.0" encoding="UTF-8"?>
<config>
<openai>
<by_azure>false</by_azure>
<base_url>https://api.openai.com/v1</base_url>
<api_version>2023-05-15</api_version>
<api_key>your-openai-api-key-here</api_key>
<timeout>30</timeout>
<model>gpt-3.5-turbo</model>
<max_tokens>150</max_tokens>
<temperature>0.7</temperature>
<top_p>1.0</top_p>
<stop></stop>
<presence_penalty>0.0</presence_penalty>
<frequency_penalty>0.0</frequency_penalty>
<response_format></response_format>
<seed></seed>
<logit_bias></logit_bias>
<user></user>
</openai>
<commit_template>
<style>conventional</style>
<max_length>72</max_length>
<include_scope>true</include_scope>
<commit_without_confirmation>false</commit_without_confirmation>
</commit_template>
</config><?xml version="1.0" encoding="UTF-8"?>
<config>
<openai>
<by_azure>false</by_azure>
<base_url>https://api.futurixai.com/api/shivaay/v1</base_url>
<api_version>2023-05-15</api_version>
<api_key>your-shivaay-api-key-here</api_key>
<timeout>30</timeout>
<model>shivaay</model>
<max_tokens>150</max_tokens>
<temperature>0.7</temperature>
<top_p>1.0</top_p>
<stop></stop>
<presence_penalty>0.0</presence_penalty>
<frequency_penalty>0.0</frequency_penalty>
<response_format></response_format>
<seed></seed>
<logit_bias></logit_bias>
<user></user>
</openai>
<commit_template>
<style>conventional</style>
<max_length>72</max_length>
<include_scope>true</include_scope>
<commit_without_confirmation>false</commit_without_confirmation>
</commit_template>
</config>$ git add .
$ gitr -c
Generated Commit Message:
==================================================
feat: Add user authentication system
==================================================
Options:
[a] Accept and commit (default)
[e] Edit message
[r] Reject (don't commit)
Choose an option [a/e/r] (or press Enter to accept):$ git add .
$ gitr -c -b
Bypassing confirmation (using generated message)...
Committing changes...
Commit successful!
Committed with message: feat: Add user authentication system$ git add .
$ gitr
Generated commit message:
==================================================
feat: Add user authentication system
==================================================- Must be run in a Git repository
- Must have staged changes (for commit operations)
- Requires API key and model configuration (OpenAI, Shivaay, or compatible API)
- Go 1.21+ for building from source
"Not in a git repository"
- Ensure you're in a Git repository directory
- Run
git initif needed
"No staged changes found"
- Stage your changes first:
git add . - Or use
gitrwithout-cto just generate a message
"Configuration error"
- Run
gitr configto set up your configuration - Ensure your API key is valid
- Check your model name is correct
"Error generating commit message"
- Verify your API key is working
- Check your internet connection
- Ensure you have sufficient API credits
gitr --helpgitr/
├── main.go # Main entry point
├── cmd/ # CLI commands
│ └── root.go
├── internal/
│ ├── config/ # Configuration management
│ │ ├── config.go
│ │ └── tui.go
│ ├── git/ # Git operations
│ │ └── git.go
│ ├── llm/ # AI integration
│ │ └── llm.go
│ └── output/ # Response parsing and TUI
│ ├── output.go
│ └── commit_tui.go
└── README.md
go build .github.com/cloudwego/eino- LLM frameworkgithub.com/cloudwego/eino-ext- OpenAI integrationgithub.com/spf13/cobra- CLI frameworkgithub.com/charmbracelet/bubbletea- TUI frameworkgithub.com/charmbracelet/lipgloss- Styling
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Built with CloudWeGo Eino for LLM integration
- Uses Cobra for CLI functionality
- Inspired by conventional commit standards