Git: A Beginner's Guide to Git (Version Control System)

About GIT

GIT is a type of Version Control System Version Control System software helps developers to work together and maintain the complete history of the work

There are two types of Version Control System

  1. Centralized version control System

Here the repository is placed in one single remote location, so to store and access the code they require the Internet Connection. If there was any connectivity issue then it is impossible to store the changes on the remote repository

2) Decentralized Version Control System

In this type, the local repository is installed on the developer’s PC, so when developers made any changes to the code, then first it’s recorded on the local machine after that all the changes are done then the final project can push into the remote repository

️ GIT

The GIT software is a type of decentralized Version Control System The GIT software is installed on the Local system and the local repository is created on it, and in the final stage, they push to the remote repository which is on the cloud.

Before we begin using GIT, we must first understand basic factors✨

Repository: — It’s a local repository that is present on the local system, and which contains the history and this history is managed by GIT (Version Control Software)

Remote Repository: — Any repository created on the web i.e.,www.github.com is called a remote repository.

Branch: — Every developer has a dedicated branch So each developer stored its data in a specific location called a branch in GIT. Like in Linux, there is a home directory, so each user has a separate data storage space.

GIT Status

While working on GIT, we must know the different areas where GIT deal with

  1. Working Area or Untracked Area

2. Staging Area or Pre-commit area or Holding Area

3. Commit Area or Git Repository

Working Area or Untracked Area

For those files which are not managed by the version control system, the Version control system is not aware of the files.

Staging Area or Pre-commit area or Holding Area

The history is lost if the file is in the untracked area and we make changes to it. To keep the history for a specific file, we must move it from the untracked area to the staging area. When a file is in the staging area, it is part of the version control system.

Commit Area or Git Repository

When a file is in the staging area, it indicates it is not permanently kept in the local repository. So, in order to permanently keep the file on the local repository, we must commit it from the staging area to the commit area. Make sure there are no modifications left before committing. The commit area is a local repository. There is no way to return it from the commit area to the staging area.

GIT Operation in different stages

homepage illustrations

The diagram above explains how GIT works with multiple stages; while the file is in the untracked region, we may use git add to push it into the staging area. If we need to work on that file again, we can use the git reset command to return to the untracked section. Once all modifications have been completed and confirmed, we may commit the file from the staging area to the commit area.

Summary: -

GIT is a type of Version Control System that helps developers to work together and maintain the complete history of the work. There are two types of Version Control Systems: centralized and decentralized. Centralized Version Control System requires the Internet Connection to store and access the code, while a decentralized Version Control System is installed on the developer's PC and the local repository is created and pushed to the remote repository. GIT has three basic components: repository, remote repository, and branch. The repository is a local repository that contains the history and is managed by GIT, while a remote repository is any repository created on the web.

A branch is a dedicated branch that stores data in a specific location. GIT operates in three stages: Working Area or Untracked Area, Staging Area or Pre-commit area or Holding Area, and Commit Area or Git Repository. The Working Area is for files managed by the version control system, while the Staging Area and Pre-commit Area are for files not managed by the Version control system. The commit Area is a local repository, and there is no way to return it from the commit area to the staging area. GIT works with multiple stages, with git adding pushing the file into the staging area and git resets returning it to the untracked section.

I hope you found this post helpful. Happy coding!

Thank you

Thank you for taking the time to read this blog. I hope you found the material helpful and instructive. Please contact us if you have any more questions or would want to learn more about the subject.

Pawan Bhagat