Git Easy · Lesson 1 · On the house

Staging area deeper

Craft the exact commit. Lesson 1 is free — on the house.

Lessons · Git Easy · Lesson 1 of 10 · On the house

Staging area deeper

Craft the exact commit.

Illustration for Git
Lesson 1 is on the house.

The index is a separate snapshot between working tree and HEAD.

You can stage part of a file with git add -p and leave other hunks unstaged.

git restore --staged path unstages without discarding working-tree edits.

status and diff --staged together tell you what the next commit will contain.

Clean commits are built in the index — not by hoping the working tree is tidy.

stage

git add -p
git diff --staged
Match this when you type.

Quiz

What sits between working tree and HEAD?

Quiz

git add -p stages?

Quiz

git restore --staged path does?

Check

Match the still for: Staging area deeper.

Open-book: the answers are on this page. Pass every quiz and check (4) to mark the lesson done. This visit: 0/4.