gg diff
Show changes with optional AI-powered summaries.
Usage
bash
gg diff # Show all changes
gg diff --staged --ai # AI summary of staged changes
gg diff --file src/app.ts # Diff for specific file
gg diff --stat # Show statistics onlyOptions
| Option | Description |
|---|---|
-s, --staged | Show staged changes only |
--file <file> | Show diff for specific file |
--stat | Show diff statistics |
--name-only | Show only file names |
--ai | Generate AI summary of changes |
--no-ai | Disable AI summary |
-n, --dry-run | Show what would be executed |
AI Summary
When using the --ai flag, GitGuru analyzes your changes and provides:
- Brief overview - Summary of what changed
- Key modifications - Important changes highlighted
- Impact assessment - Low/Medium/High impact rating
- Potential concerns - Issues to watch out for
bash
$ gg diff --staged --ai
š Changes Summary (AI Analysis)
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Overview:
Added user authentication with JWT tokens
Key Modifications:
⢠New auth middleware in src/middleware/auth.ts
⢠Login/logout routes in src/routes/auth.ts
⢠User model updated with password hashing
Impact: Medium
- Core authentication flow added
- Existing routes unaffected
Potential Concerns:
ā Ensure JWT secret is stored securely
ā Consider rate limiting for login endpointExamples
View All Changes
bash
# Show all unstaged changes
gg diff
# Show all changes with AI summary
gg diff --aiView Staged Changes
bash
# See what will be committed
gg diff --staged
# Get AI analysis before committing
gg diff --staged --aiView Specific File
bash
# Diff for one file
gg diff --file src/app.ts
# Multiple ways to check a file
gg diff --file src/components/Button.tsx --aiStatistics Only
bash
# Quick overview of changes
gg diff --stat
# Just file names
gg diff --name-onlyPre-Commit Review
Always run
gg diff --staged --ai before committing to get an AI analysis of your changes. This helps catch issues early and ensures your commit is focused.Recommended Workflow
bash
# 1. Make your changes
# 2. Check what changed
gg diff
# 3. Stage files
gg add
# 4. Review staged changes with AI
gg diff --staged --ai
# 5. Commit with confidence
gg commit --ai