Warm-up · from “What add and commit actually do”
When is a blob normally written?
When is a blob normally written?
No notes: write what you remember, then check. Recalling before reading is what makes it stick.
The problem
Your pull request includes a surprise line. Learn to inspect exactly what is staged, what is only on disk and what changed between commits.
After this lesson you can
Interpret short status.
Choose the correct diff comparison.
Explain why untracked files do not appear in ordinary diff.
Key terms
Full glossarySay what each term means, then open it to check.
Index · from lesson 9
Prepared path-to-object entries, plus metadata and conflict stages.
Commit · from lesson 7
Object identifying a root tree, parent(s), metadata and message.
Tree · from lesson 6
Directory snapshot mapping names, modes and object IDs.
HEAD · preview, covered in lesson 14
Current symbolic branch reference or detached commit identity.
Visual mental model
- HEAD
- Indexdiff --staged
- Working treediff
Build the mental model
Plain git diff compares working files with the Index, showing unstaged tracked changes. git diff --staged compares the Index to HEAD (or an empty tree before the first commit). git diff HEAD compares tracked working-tree state with the current commit. Untracked files normally do not appear in these diffs; use status to discover them.
A simplified model for building intuition. It does not read your sandbox; use the terminal for real behaviour.
Under the hood
Short status has two columns: the first describes Index changes relative to HEAD, and the second describes working changes relative to the Index, except special conflict and untracked cases. MM means modified in both comparisons. In a unified diff, minus lines were removed, plus lines were added, and context helps locate the change. Inspect a diff before staging and before committing.
Common mistake · important nuance
The two dots and three dots of revision ranges have command-specific meanings; see lesson 15.