Back to roadmap

Lesson 03

Staging Area

The staging area lets you choose which changes will go into your next commit.

Visual Explanation

Working Directory

Unstaged changes only

app.jsModified

Staging Area

Snapshot for the next commit

Empty

app.js has an unstaged change. The file itself remains in your project.

The Real Command

Terminal
git add app.js

git add app.js prepares that file's current changes for the next commit.

Command Details

git add -- "*.js"

* is a quoted Git path pattern. The quotes pass the pattern to Git, and -- ends option parsing.

git add .

. means this directory. It stages all current changes below this folder, so review git status first.

Knowledge Check

Build the Next Checkpoint

Choose a change for the next commit and separate staging from committing.

Question 1 of 5

  1. Question 1: current
  2. Question 2: not started
  3. Question 3: not started
  4. Question 4: not started
  5. Question 5: not started
Command Challenge

Only app.js should go into the next commit. Type the command that prepares it.