analyze command provides AI-powered insights about your code changes without creating a commit. Use it to understand the impact and nature of your modifications before committing.
Basic Usage
- Check for staged changes (falls back to unstaged if none are staged)
- Analyze the diff using AI
- Display a detailed analysis of the changes
Command Options
AI model to use for analysis.Allowed values:
claude- Anthropic Claudeopenai- OpenAI GPT modelsgemini- Google Geminigrok- xAI Grokllama- Meta Llamadeepseek- DeepSeek, Inc.github- GitHub Modelsollama- Ollama (local models)free- Free tier via LLM7.io (no API key required)
-mAPI key for the selected model. If not provided, GitWhisper will use:
- Saved configuration (via
gw save-key) - Environment variables
ollama and free models.Shorthand: -kSpecific variant of the AI model to use.Examples:
gpt-4o(OpenAI)claude-sonnet-4-20250514(Claude)gemini-2.0-flash(Gemini)
-vUsage Examples
Terminal Output Example
When to Use Analyze
Code Review Preparation
Before creating a pull request, useanalyze to:
- Understand the full scope of your changes
- Identify potential issues or improvements
- Prepare better PR descriptions
Learning and Understanding
When working with unfamiliar code:- Analyze changes made by others
- Understand the impact of refactoring
- Learn about architectural decisions
Pre-Commit Validation
Before committing:- Verify changes align with intended goals
- Catch unintended modifications
- Ensure nothing important was missed
Multi-Repository Analysis
If run from a parent directory containing multiple git repositories, GitWhisper will:- Detect all subdirectories with changes (staged or unstaged)
- Generate individual analyses for each repository
- Display results grouped by repository name
Staged vs Unstaged Changes
Staged changes (default priority):Analysis Language
By default, analysis is generated in English. You can change the language using:commit and analyze commands.
Environment Variables
API keys can be provided via environment variables:Related Commands
- commit - Generate commit messages from changes
- set-defaults - Configure default model
- list-models - View available AI models