Skip to content

Understand what enters your next commit

≈ 10 minutesBeginner4 steps · 10 min estimated

Outcome. Predict exactly what `git commit` will record, by reading `git status` as three places rather than one.

Before you start: Git installed and a first commit made

The duration is an estimate of engaged work, not a timer — nothing here waits. Steps marked "Check" and "Practice" are verified in the browser; "Read" and "Lab" steps are yours to confirm.

  1. Read

    The five states a file can be in

    ≈ 3 min

    Read this section and the one after it ("Reading git status"). Look for the two columns in `git status --short` — they are two different places.

  2. Predict

    Predict: what does this commit contain?

    ≈ 1 min

    Answer before you look anything up.

    You edit `app.js`, run `git add app.js`, then edit `app.js` again and run `git commit -m "x"`. What does the commit contain?
    Why

    `git add` copies the file *as it was* into the index. The commit records the index. Your second edit is still only in the working tree — `git status` shows the file as both staged and modified.

  3. Open Practice Mode on the lab page and choose "Unstage a file without losing the edit". Success is checked against the repository state.

    Scenario: Unstage a file without losing the edit — completes automatically when the simulator's check passes.

  4. Check

    Knowledge check: the index

    ≈ 2 min

    Four questions. A wrong answer shows the reasoning immediately.

    Completes when the knowledge check on that page has been attempted.

When you are done: Choose a safe way to undo a change. Now that you can see where a change lives, the next skill is putting it back — with the right tool for each place.

How did this go?