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 only

Options

OptionDescription
-s, --stagedShow staged changes only
--file <file>Show diff for specific file
--statShow diff statistics
--name-onlyShow only file names
--aiGenerate AI summary of changes
--no-aiDisable AI summary
-n, --dry-runShow 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 endpoint

Examples

View All Changes

bash
# Show all unstaged changes
gg diff

# Show all changes with AI summary
gg diff --ai

View Staged Changes

bash
# See what will be committed
gg diff --staged

# Get AI analysis before committing
gg diff --staged --ai

View 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 --ai

Statistics Only

bash
# Quick overview of changes
gg diff --stat

# Just file names
gg diff --name-only
Pre-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