From the course: Git Essential Training

Use Git locally

- We have seen what the concept of Git is. Now let's get an understanding of how it works on a technical level. In this video, we're going to look at what happens when we use Git locally. A lot is happening on a local level. Let's see how it works. We have a local folder in the file explorer or finder or what file management program you are using. Git brings us two extra containers, the staging area and the local repository. Let's say we create a file. It doesn't matter what kind. And we save it in the local folder like we would do if we didn't use Git. What we want to do now is create a snapshot of one of these files before we move on. So we want to grab the current state. First, we need to decide what changes we want to make a snapshot of. To do that, we add it to the staging area. We use Git Add and a filename to make this happen like this. Or we can use Git Add and a dot. This will add all the changes to the staging area. Once we are happy with the changes, we want to create a snapshot. To do that, we need to add the files to the local repository. So to add them to the local repository we simply use Git Commit. The local repository will keep a database with all the changes that were stored in those snapshots. We still can continue to work in our local folder but we have a snapshot with the state of all the files at that specific time. So by using Git locally, we can create snapshots of what has happened and move back to all the versions if we want to, without having to keep track of all those changes in the file explorer.

Contents