/explain-changes is a slash command that generates AI-powered explanations for any git diff. Unlike the Explain Changes button which explains changes from a completed task, this command lets you explain changes between any two git references - commits, branches, tags, PRs, staged changes, or your working directory.
Requirements
The
/explain-changes command requires a git repository. Make sure you’re working in a directory that has been initialized with git.Using the Command
Type/explain-changes in the chat input. Cline will:
- Analyze your git history to understand what changes exist
- Gather context by reading relevant files
- Determine appropriate git references to compare
- Generate a diff view with streaming inline explanations
How It Works
When you use/explain-changes, Cline:
- Gathers context: Runs git commands to understand your repository state
- Identifies changes: Determines which files changed between references
- Reads relevant files: Builds context for better explanations
- Calls generate_explanation: Creates the diff view and streams explanations
- Displays results: Opens a multi-file diff with inline comments
Use Cases
Explain the Last Commit
The most common use case - understand what changed in the most recent commit:- After pulling changes from a teammate
- Reviewing your own work before pushing
- Understanding what a merge commit brought in
Explain Uncommitted Changes
Understand your work-in-progress changes before committing:- Before staging changes to ensure they’re complete
- After a long coding session to remember what you changed
- To verify changes before creating a commit
Explain Staged Changes
Review exactly what you’re about to commit:git add.
When to use:
- Final review before committing
- When you’ve staged a subset of changes and want to verify
- To ensure you haven’t accidentally staged unintended files
Explain a Specific Commit
Understand any commit in your history:- Investigating when a bug was introduced
- Understanding historical decisions
- Learning how a feature was implemented
Explain a Range of Commits
Understand multiple commits at once:- Understanding what changed in a release
- Reviewing a series of related commits
- Catching up after being away from the project
Explain a Pull Request
Get AI explanations for any PR:- Reviewing someone else’s PR
- Understanding a PR before approving
- Learning from PRs in open source projects
- Preparing to give PR feedback
Explain Branch Differences
Compare any two branches:- Before merging a feature branch
- Understanding divergence between branches
- Planning a merge or rebase strategy
- Reviewing what a colleague has been working on
Explain Changes to Specific Files
Focus on particular files or directories:- Understanding changes to a specific module
- Tracking modifications to critical files
- Learning how a particular feature evolved
Explain Changes Since a Tag
Understand what’s changed since a release:- Preparing release notes
- Understanding what’s new since a deployment
- Identifying changes for a changelog
Explain a Merge Commit
Understand what a merge brought in:- After merging a large feature branch
- Understanding what a merge conflict resolution changed
- Reviewing what others merged into main
Explain Stashed Changes
Review what’s in your stash:- Before applying a stash
- Deciding whether to keep or drop a stash
- Remembering what you stashed days ago
Interactive Comments
Just like the Explain Changes button, the generated comments are fully interactive:Reply to Comments
Ask follow-up questions directly in any comment thread:- “Why was this function refactored?”
- “What’s the purpose of this new parameter?”
- “Could this cause any breaking changes?”
- “Is this change backwards compatible?”
Move to Main Chat
Click the title area of any comment thread to move that conversation into Cline’s main chat. This is useful when:- You want Cline to make additional changes
- The discussion reveals something that needs more investigation
- You want to continue working with full Cline capabilities
- A review comment sparks an idea for improvements
The generate_explanation Tool
Under the hood,/explain-changes uses the generate_explanation tool with these parameters:
| Parameter | Description | Example |
|---|---|---|
title | Descriptive title for the diff view | ”Changes in commit abc123” |
from_ref | Git reference for the “before” state | HEAD~1, main, origin/main |
to_ref | Git reference for the “after” state (optional) | HEAD, develop |
to_ref is omitted, the tool compares against the working directory.
Tips for Better Explanations
-
Be specific: Instead of just
/explain-changes, tell Cline what you want explained. “Explain the authentication changes in PR #42” gives better context than just “explain PR #42”. - Ask about intent: The AI can explain not just what changed but why. Ask follow-up questions like “What problem was this solving?”
-
Chain with other commands: Use
/explain-changesafter investigating an issue to understand potential fixes, then continue with Cline to implement improvements. -
Use for learning: When onboarding to a new codebase, use
/explain-changeson significant PRs or commits to understand how features were built.
Related Features
- Explain Changes - The button-based version for task completions
- Checkpoints - Enables the Explain Changes button
- @git mentions - Reference git diffs in your prompts

