Git Part 2: The Three Worlds System

Henry Steinhauer
Analytics Vidhya
Published in
3 min readDec 3, 2020

Today we take a look at Git and why the staging area is very useful.

Photo by Phil Botha on Unsplash

Today there are lots of different version control systems. One of the most famous is Git. But what are the reasons? How did Git manage to stand out? One important cause will be discussed today.


  • 3 Layer-System
  • Benefit of the Staging Area
  • Conclusion

3 Layer-System

Git consists of three areas. Below you can see their names and order. First, we’ll try to get an idea of how they work.

Working Directory
On the working directory, we have a single uncompressed version of the project. So we can make modifications and add new features. Besides, changes in the working directory are marked, but not stored in the Git database. If we lose changes, it’s not possible to restore them. Below is an overview of the flagged changed files.

Staging Area
The second layer is called the staging area or index. As soon as we move changes from the working tree to the staging area, we store a snapshot of all the changes to the files in the Git database. Files that we don’t change are only referenced. The corresponding command is git add filename. Or if you want to save all changes, you can use the wildcard. To do this, you must replace the filename with the dotted character. The changes are not saved permanently. All changes that aren’t committed to the git directory within a certain period are removed by the garbage collector. To see the status of the staging area, as well as the status of the working area as above, we need to type the command git status.

Git Directory
The last part is the Git directory. This is where the snapshots are stored permanently in the Git database. Additionally, all saved changes are linked to the project history. To do this we have to commit the changes from our staging area -> git commit -m "description".

Benefit of the staging area

Most version control systems consist of a 2-layer system. One reason for Git to stand out is the layer between them. But why? What is the advantage?

In my mind, the greatest benefit is the control over what we want to commit to our git directory. In other version control systems, we simply store all the changes we have made. But in Git, it’s a bit different. Here, we can make changes and later decide which files we want to store group. We have commands like git reset, git stash, git commit -p and much more. So we can build our commits completely free. If you have additional benefits, it would be great to leave them in the comments.


Today we took a look at Git’s 3-layer system. In the end, you should know the differences between the layers and what they are used for. We also talked about the benefit of the staging area. If you have any questions or feedback, please let me know in the comments. See you soon.

In my following article, we will do an exciting tour through the .git directory. Buckle up and let’s go -> Discover the .git Folder.



Henry Steinhauer
Analytics Vidhya

Passionate software developer who enjoys exploring new programming languages, design patterns and frameworks.