Git Diff - Compare Commits

VerifiedSafe

Displays file-by-file diffs between two commits or between a commit and the working tree, including additions, deletions, and change hunks. Helps with code review, debugging regressions, and understanding history changes.

Sby Skills Guide Bot
DevelopmentBeginner
6/2/2026
Claude CodeCursorWindsurf
#git#diff#version-control#code-review

Recommended for

Automated summary

Shows changes between two commits or between a commit and the working tree, providing file-by-file diff information.

Strengths

  • Provides line-by-line detail of additions and deletions
  • Allows filtering by file or directory for targeted diffs
  • Supports all commit references (hash, branch, tag, relative)

Limitations

  • Does not handle diffs between remote branches without prior fetch
  • Can be slow on very large repositories or wide commit ranges
  • Does not show global statistics (total files changed)
When to use it

Use this skill to quickly inspect changes in a recent commit, compare two branches, or examine the evolution of a specific file.

When not to use it

Do not use it for complex history analysis or if you need an interactive diff with hunks rejection or staging (prefer a dedicated tool like `git difftool`).

Security analysis

Safe
Quality score90/100

The skill only runs read-only git diff commands, with no destructive or exfiltrating actions. No risk of executing harmful commands from the skill itself, though user-supplied commit references could be unsafe if not sanitized.

No concerns found

How this analysis is made

Examples

Last commit changes
Show diff from HEAD~1 to HEAD
Branch comparison
Show diff from main to feature/auth
Specific file diff
Show diff from HEAD~5 to HEAD for path /src/main.go

name: git-diff description: Show changes between two commits or between a commit and the working tree. Returns file-by-file diff information including additions, deletions, and change hunks. allowed-tools: Bash metadata: category: git version: 1.0.0

Git Diff Skill

This skill shows changes between two commits or between a commit and the working tree, providing detailed diff information for each changed file.

Usage

The git-diff skill compares two points in the repository history and returns detailed information about what changed.

Parameters

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | from_commit | string | Yes | - | Starting commit reference (hash, branch, tag, HEAD~n) | | to_commit | string | No | HEAD | Ending commit reference | | path | string | No | - | Filter diff to specific file or directory |

Commit References

You can use various formats for commit references:

  • Full commit hash: abc123def456...
  • Short hash: abc123
  • Branch name: main, feature/auth
  • Tag: v1.0.0
  • Relative: HEAD~1, HEAD~3
  • Range: Compare between any two references

Example Usage

Show changes in the last commit:

Show diff from HEAD~1 to HEAD

Show changes between branches:

Show diff from main to feature/auth

Show changes for a specific file:

Show diff from HEAD~5 to HEAD for path /src/main.go

Result Format

The diff result includes:

  • List of changed files with:
    • File path (and old path if renamed)
    • Status (A=Added, M=Modified, D=Deleted, R=Renamed)
    • Number of additions and deletions
    • Change hunks with line numbers
  • Total additions across all files
  • Total deletions across all files

Status Codes

| Code | Meaning | |------|---------| | A | Added - New file | | M | Modified - Existing file changed | | D | Deleted - File removed | | R | Renamed - File moved/renamed | | C | Copied - File copied |

Best Practices

  1. Use relative references (HEAD~n) for recent changes
  2. Filter by path for large diffs
  3. Compare against main/master to see feature changes
  4. Check both additions and deletions for context

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/git-diff-compare-commits-mm5t8aph' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/git-diff-compare-commits-mm5t8aph/download' --output '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md.part' && mv '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md.part' '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md' && test -s '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/git-diff' && cp -R '.skill-downloads/git-diff-compare-commits-mm5t8aph' '.claude/skills/git-diff'

Cursor
test -f '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md' && test -s '.skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/git-diff' && cp -R '.skill-downloads/git-diff-compare-commits-mm5t8aph' '.cursor/skills/git-diff'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/git-diff-compare-commits-mm5t8aph'

openskills read 'git-diff-compare-commits-mm5t8aph'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/git-diff-compare-commits-mm5t8aph/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills