What git diff (no args) is built on.
git diff-files compares the working tree against the index (staged content). It's the engine under bare 'git diff' (no args) and is the canonical way for scripts to ask 'what's modified but not yet staged?'
Two sides: index (left) and working tree (right). For unmerged paths it sees stages 1/2/3 (base/ours/theirs) and can show the relevant view of conflicts.
git diff-files [-p] [-u] [-q] [--raw] [-1|-2|-3|-c|--cc]
[--base|--ours|--theirs] [--ita-invisible-in-index] [<path>...]| Flag | What it does |
|---|---|
-p / -u | Generate a unified patch (text diff). Same as 'git diff' output. |
-q | Silent; exit non-zero if any difference exists. Great for scripts. |
--raw | Default-ish machine-readable format: mode/sha/status per path. |
-1 / -2 / -3 (--base/--ours/--theirs) | For unmerged paths, diff against that conflict stage only. |
-c / --cc | Combined / dense-combined diff for merge conflicts (multi-parent view). |
--ita-invisible-in-index | Treat 'intent-to-add' (git add -N) entries as not-yet-in-index. |
git diff-files -pgit diff-files --quiet || echo 'dirty tree'git diff-files --rawgit diff-files --theirs path/to/conflictedHit each option, then Check answers. Score is recorded; Next is always open.