Git diff with content
git_diff_contentShow git diff as structured patch content with parsed hunks per file, so you can inspect actual code changes instead of raw unified diff text. Scope by refs, path, staged changes, or context lines.
Instructions
Show git diff with structured patch content. Returns parsed hunks per file instead of raw unified diff text. Use this when you need to see actual code changes, not just file-level stats. Use base+ref for two-ref comparison (e.g. base='main', ref='feature'). Use path to scope to one or more files or directories.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory (git repo) | |
| ref | No | Diff against this ref (e.g. 'HEAD~1', 'main', a commit hash) | |
| base | No | Base ref for two-ref comparison. When both ref and base are set, runs git diff <base> <ref> | |
| path | No | Limit diff to one or more files or directories (string or array) | |
| staged | No | Show staged changes (--cached) | |
| context | No | Number of context lines around changes (passed as -U<n>) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| summary | Yes | ||
| retained | No |