Git diff
git_diffCompares Git refs or staged changes and returns changed files with insertion/deletion counts. Scope results by file path or compare two refs for structured diff output.
Instructions
Structured git diff: files changed with insertions/deletions counts. 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 | Repository path | |
| ref | No | Ref to diff against (e.g. 'main', 'HEAD~3') | |
| 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 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| retained | No | ||
| fileCount | Yes | ||
| totalDeletions | Yes | ||
| totalInsertions | Yes |