World map

 

BM: Baca dalam Bahasa Melayu

World 1: Save Points

Three places your work lives

You will learn: the three places Git keeps your work.

The problem

index.html wobbles in the working folder with a changed tag.

You pressed save in your editor. So Git saved it too, right? Not yet! Your work can sit in three places.

Watch

The blue working folder glows. It holds index.html and style.css. The box and the repository are empty.

Place 1 is the working folder. These are your normal files. You edit them here.

Watch

The command git add index.html types itself. index.html slides from the working folder into the amber box.

Place 2 is the staging area, a box. git add puts ready changes in the box.

Watch

Camera flash. The box empties, and a new commit called Add home page lands in the green repository.

Place 3 is the repository. git commit takes a photo of the box and keeps it here, safe.

Predict

You make a new file, notes.txt. Where is it now?

Pick one answer.

Predict

You type git add notes.txt. Where is it now?

Pick one answer.

Predict

You type git commit -m "Add notes". Where does the saved copy go?

Pick one answer.

You did it!

You can now name the three places your work lives.

Go deeper (optional)

You will meet other names for these places. The working folder is also called the working tree. The staging area is also called the index. The repository lives inside the hidden .git folder.