Git Core Concept



GIT Repository

Git repository is the .git/ folder inside the working directory.

Git repository contains a collection of files, history of changes, and any special configuration.

Git repository tracks all modifications made to files over time.

git repository

Three States of Git

  • Working directory

    The working directory is the directory on your computer that holds all the application files.

    Files within the working directory may or may not be managed by Git. However, Git is aware of them.

    Within the Working directory is a hidden folder called the .git/ folder that contains the actual git repository.

  • Staging area (Git Index)

    The staging is the holding area for queueing up changes for the next commit.

    Since files in the staging area haven't been committed yet, you can move the files in and out of the staging area without changing the Git repository history.

  • Git repository (directory)

    The git repository manages the git commit history. It contains all the changes that are finalized and permanently part of the git repository.

Three states of git

Remote repository

A remote repository is a shared repository that all team members use to exchange their modifications. One of the most famous code hosting services is GitHub.

We can say that the remote repository is the fourth state. Even the remote repository is just another repository with its own three states internally. Conceptually you can think of the remote repository as a fourth state.


Branch master

Branches on git work as they do in other source control systems. They are timelines that contain your changes (commits).

A branch in Git is simply a movable pointer to one of these commits. The default branch on git is named Master.

As you add more commits, you're given a pointer HEAD that points to the last commit you made.

sequence of commits

Note: You will see more git core concepts later in the tutorial.



ExpectoCode is optimized for learning. Tutorials and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy.
Copyright 2020-2021 by ExpectoCode. All Rights Reserved.