Complete guide to setting up and using GitWhisper - the AI-powered Git commit message generator that whispers the perfect commit message for your changes.
GitWhisper analyzes your staged Git changes and uses AI to generate meaningful commit messages following conventional commit format with emojis. It supports multiple AI models including OpenAI GPT, Claude, Gemini, and more.
Choose your preferred installation method
Configure your AI provider credentials
Let AI create perfect commit messages
If you have Dart installed, this is the easiest method:
dart pub global activate gitwhisper
For macOS users with Homebrew:
brew tap iamngoni/homebrew-gitwhisper
brew install gitwhisper
For Debian-based Linux distributions:
echo "deb [trusted=yes] https://iamngoni.github.io/gitwhisper-apt stable main" | sudo tee /etc/apt/sources.list.d/gitwhisper.list
sudo apt update
sudo apt install gitwhisper
For Windows users with PowerShell (run as Administrator):
irm https://raw.githubusercontent.com/iamngoni/gitwhisper/master/install.ps1 | iex
Universal installation script for Unix-based systems:
curl -sSL https://raw.githubusercontent.com/iamngoni/gitwhisper/master/install.sh | bash
gitwhisper --version
to confirm the installation was
successful.
GitWhisper requires an API key from at least one AI provider. Here's how to get and configure API keys for each supported provider:
# Save API key permanently
gitwhisper save-key --model openai --key "your-openai-key"
# Or set as environment variable
export OPENAI_API_KEY="your-openai-key"
# Save API key permanently
gitwhisper save-key --model claude --key "your-claude-key"
# Or set as environment variable
export ANTHROPIC_API_KEY="your-claude-key"
# Save API key permanently
gitwhisper save-key --model gemini --key "your-gemini-key"
# Or set as environment variable
export GEMINI_API_KEY="your-gemini-key"
# Save GitHub token permanently
gitwhisper save-key --model github --key "your-github-token"
Now that you have GitWhisper installed and your API key configured, let's create your first AI-generated commit message.
First, make some changes to your files and stage them:
# Stage all changes
git add .
# Or stage specific files
git add src/main.dart
git add README.md
Use GitWhisper to analyze your changes and generate a commit message:
# Generate commit with Gemini (free option)
gitwhisper commit --model gemini
# Or use the shorthand
gw commit --model gemini
# Or just use defaults if configured
gw
GitWhisper will analyze your changes and present a commit message for review:
🔮 Analyzing your changes...
✨ Generated commit message:
feat: ✨ Add user authentication system
Apply this commit message? (y/n): y
✅ Commit created successfully!
Configure GitWhisper to match your preferences
and workflow. All settings are stored in
~/.git_whisper.yaml
.
Save your preferred AI model and variant to avoid specifying them every time:
# Set default model and variant
gitwhisper set-defaults --model gemini --model-variant gemini-2.0-flash
# Set default model only
gw set-defaults --model claude
# For Ollama with custom URL
gw set-defaults --model ollama --model-variant llama3 --base-url http://localhost:11434
Configure GitWhisper to automatically stage changes before generating commit messages:
# Enable auto-staging
gitwhisper always-add true
# Disable auto-staging
gw always-add false
# Show current defaults
gitwhisper show-defaults
# Clear all defaults
gw clear-defaults
Set your preferred language for AI-generated commit messages and analysis. GitWhisper supports over 20 languages while maintaining conventional commit format compatibility:
# Change language interactively
gitwhisper change-language
# Shorthand
gw change-language
feat: ✨ Agregar funcionalidad
de modo oscuro
(Spanish)
GitWhisper supports generating commit messages and analysis in over 20 languages. Configure your preferred language while maintaining conventional commit format compatibility.
Use the interactive language selector to choose your preferred language:
# Change language interactively
gitwhisper change-language
# Shorthand
gw change-language
The commit type (feat:, fix:, etc.) and emoji remain in English for universal tool compatibility, while the description is generated in your selected language.
The complete analysis response, including headers, explanations, and recommendations, is provided in your selected language.
GitWhisper supports multiple AI models, each with different variants optimized for various use cases.
Provider | Model | Cost | Best For |
---|---|---|---|
Gemini | Free (generous limits) | Getting started | |
GitHub | Various | Free (rate limited) | Experimentation |
OpenAI | GPT-4, GPT-4o | Paid | High quality results |
Anthropic | Claude 3 | Paid | Detailed analysis |
Ollama | Self-hosted | Free (your hardware) | Privacy & control |
# List all available models
gitwhisper list-models
# List variants for a specific model
gw list-variants --model openai
Add ticket numbers or task IDs to your commit messages:
# Add ticket prefix
gitwhisper commit --prefix "JIRA-123"
# Result: fix: 🐛 JIRA-123 -> Fix login validation bug
Automatically push commits to remote repository:
# Commit and push in one command
gitwhisper commit --auto-push
# Shorthand
gw commit -a
Get detailed analysis and suggestions for your code changes:
# Analyze staged changes
gitwhisper analyze
# Analyze with specific model
gw analyze --model claude
Problem: GitWhisper requires staged changes to analyze.
Solution:
# Stage your changes first
git add .
# Then run GitWhisper
gitwhisper commit
Problem: No API key configured for the selected model.
Solutions:
# Save API key permanently
gitwhisper save-key --model openai --key "your-key"
# Or provide key inline
gitwhisper commit --model openai --key "your-key"
# Or set environment variable
export OPENAI_API_KEY="your-key"
Problem: You've hit the API rate limits.
Solutions:
Here are real examples of commit messages generated by GitWhisper:
feat: ✨ Add user authentication system
- Implement JWT token generation
- Add login/logout endpoints
- Create user registration flow
- Add password hashing with bcrypt
fix: 🐛 Resolve memory leak in image processing
- Fix improper disposal of image objects
- Add proper cleanup in finally blocks
- Update unit tests for memory management
docs: 📚 Update API documentation
- Add examples for new endpoints
- Fix typos in authentication section
- Update installation instructions
perf: ⚡ Optimize database queries
- Add indexes for frequently queried fields
- Implement query result caching
- Reduce N+1 query problems
A: For beginners, start with Gemini (free with generous limits) or GitHub models (free but rate-limited). For production use, OpenAI GPT-4 or Claude 3 provide excellent results. Ollama is great if you want complete privacy and control.
A: Yes! You can use Ollama with locally hosted models for completely offline operation. You'll need to install and run Ollama with your preferred model first.
A: Costs vary by provider. Gemini and GitHub models are free. OpenAI and Claude are paid services but very affordable for typical usage - usually a few cents per month for individual developers.
A: GitWhisper follows the conventional commit format with emojis by default. The AI models are trained to generate consistent, well-formatted messages. For custom formats, you can always edit the generated message before committing.
A: Only your git diff (changes) are sent to the AI provider for analysis, not your entire codebase. If privacy is a concern, use Ollama with local models for complete data control.