Staging area
- Git course
- Beginner
- Lesson 17/80
- 4 min
Learn where the staging area sits between the working tree and the repo.
What Is the Staging Area?
The staging area is a preparation space between the working tree and the Git repository. You collect the changes you want to save here before creating a commit. Git also refers to this area as the index.
Working tree → Staging area → RepositoryUnderstand the Index
Index is another name for the staging area. Git tracks the changes selected for inclusion in a commit in this area.
Working tree
↓
Index
↓
RepositoryPractice Display the Change Flow
Place Git's three basic areas in the correct order inside a string variable. Then print this flow.
The expected output connects the areas with arrows.
Starter code
// Alanların sırasını tanımla
let flow;
console.log(flow);Sample solution
let flow = 'working_tree -> staging_area -> repository';
console.log(flow);Expected output
working_tree -> staging_area -> repository
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which two areas does the staging area sit between?
- Two different repositories
- File system and browser
- Remote server and terminal
- Working tree and repository Correct answer
Explanation: The staging area is the preparation layer between working tree changes and the Git repository.
2 Complete the Other Name for the Staging Area
Git'in staging area için kullandığı diğer ad ____ olarak bilinir.
Git'in staging area için kullandığı diğer ad index olarak bilinir.
Explanation: In Git documentation, the staging area is also called the <code>index</code>.
3 Match the Basic Git Areas
| Term | Meaning |
|---|---|
working_tree |
Area where files are worked on |
staging_area |
Preparation area for commits |
index |
Another name for staging area |
repository |
Place where commits are stored |