Review changes and staging with diff

Review exact working-tree and staged changes before committing.

Difficulty
beginner
Time
35 minutes
Last verified
9/21/2026

What you will build

Review exact working-tree and staged changes before committing.

Understand the idea first

Review exact working-tree and staged changes before committing.

Build it step by step

git diff
git add css/style.css
git diff --staged
git restore --staged css/style.css
  1. Open the previous project and record its result.
  2. Type the example and complete: Change two files, stage one, and prove staged diff contains only intended work.
  3. Change one input, predict, then verify.
  4. Create and repair: Git add is not save; read diffs before and after staging.

Read the important lines

  • Review exact working-tree and staged changes before committing.
  • Read input, processing, and output separately.
  • Verify another input and an edge case.

Common mistakes and what to check

SymptomWhat to check
Unexpected resultGit add is not save; read diffs before and after staging.
Nothing changesSave, verify paths, and read the first relevant Console error.

Practice without copying

Change two files, stage one, and prove staged diff contains only intended work.

Check the answer after you try

Rebuild and explain the decisions. Check: Git add is not save; read diffs before and after staging.

Completion check

  • I produced the required visible result
  • I can explain the input, processing, and output
  • I tested normal, edge, and failure cases

Your privacy choices

Necessary storage is always on. Optional analytics and support services load only after consent.