Git in a Minute · beginner

Git in a Minute: Diffs

A diff shows what changed between snapshots—your primary review tool for agent output.

Last verified: 2026-09-06

In one sentence

A diff is the readable delta between two Git states—usually your working tree versus HEAD, or one commit versus another.

Why it matters

You cannot trust an agent transcript alone. The diff is ground truth for what will ship.

How it works

Common views:

  • git diff — unstaged changes;
  • git diff --staged — staged changes;
  • git diff main...HEAD — branch changes since divergence.

Read diffs for unintended files, deleted tests, widened permissions, and drive-by refactors. Ask the agent to explain any hunk you did not request.

Example

git status
git diff
git diff --stat

If the stat list includes files outside scope, stop and reset scope before committing.

Agentic coding use

Diff review is the human half of agentic delivery. Pair it with verification gates: green tests plus a clean diff beat either signal alone.

Watch out

Word-wrapped or binary diffs can hide damage. For critical paths, open the files and run the focused tests yourself.

Sources