Understand different Git states and the corresponding file states

Let’s learn a bit more about Git basics

Lynn G. Kwong
3 min readDec 20, 2020
Photo by Mohammad Rahmani on Unsplash.

There are four Git states, namely the local working directory, the staging area, the local repository, and the remote repository.

Different Git states and file states

The local working directory is the folder where the hidden .git folder is located. It is the project folder where you run the git init command or the folder you cloned from GitHub or Git Lab. Only the files inside the project folder can be tracked by git. And any file inside this directory can be tracked, no matter if it is in a subdirectory or not.

The staging area is a virtual git state, files in the staging area have been tracked by git and are ready to be committed to the local repo.

Local repo is a bit more complex and can be confusing for beginners. Local repo is also a virtual git state, normally it refers to the hidden .git folder. This folder handles all the magic heavy lifting work of git. However, the files in the git folder have been treated specially and are not human readable. So don’t bother to find your files there. However, if you make some commits, you will find that the size of…

--

--

Lynn G. Kwong

I’m a Software Developer (https://medium.com/@lynn-kwong) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.