December 2, 2022

Detailed Guide to Learn GIT Basics

Are you looking to learn GIT in a short period? If you are new to coding, you need a basic guide to learn GIT. Before understanding GIT deeply, Let’s understand what GIT is and GIT basics.

GIT is a distributed version control system that allows multiple people to work in parallel and it saves a history of all changes made. This is a tracking tool that changes computer files and coordinates work on those files among multiple people. Through GIT we can track the changes, changes history, who made the changes, when they made the changes and why they made the changes.

By learning GIT Basics, one can understand how to install GIT, create a local GIT Repository, GIT Branches, Moving Code Between Local and Remote Repository, tagging and many more. Git does not necessarily rely on a central server to store all the versions of a project’s files. The clone has all of the metadata of the original while the original itself is stored on a self-hosted server or a third-party hosting service like GitHub. GIT is used by many clients for various projects. But the technology is the same for everyone and all projects. So let’s see one by one.

How does GIT help?

GIT helps to manage multiple projects with branches and merging options. Branches help you to work in different parts and different versions of projects without disturbing other codes or works. You can also push local updates to the main project and you can share your work with other colleagues or to the world to get output from them.

Why Git?

GIT is used by many developers. As per the report, 70% of the developers prefer GIT to work. One can sit in any part of the world and connect with another part of the world and work together through GIT. The major advantage of the GIT is developers can see the changes and history of the project. They can also revert to an earlier version of a project.

Moreover, GIT is free.

Git Installation

If you have not installed GIT in your system, you can download it from You can install it with the help of installation guidelines.

Installation link:

After the installation, you can type the following in your terminal to see if it was installed git –version.

NOTE: For Windows users, it will be the command prompt and for Mac users, it will be the terminal to interact.

What is a Repository and Creating a Local Git Repository

The repository is nothing but a collection of code sources. If you are starting afresh or a new project you need to create a local GIT repository. Your files and checkpoints changes will be stored to allow versions. Create a folder on your Desktop – open up your terminal (or Command Prompt) – copy the commands

  • 1st line of command – navigate to the folder
  • 2nd line of command – local repository.

Let’s take an example of Vegetables, we will create a file with the name of vegetables in the GIT folder. Copy the codes and exit.

veggies = [‘Tomato’, ‘potato’, ‘Onion’, ‘Raddish’, ‘sweet potato’, ‘Bell peppers’, ‘baby corn’]

NOTE: If you don’t have python installed on your system, you can create a .txt file instead of a .py file).

Committing Files to the Local Repository

We have already created one file in the local system folder. Now we have to add these files into the local repository to start tracking the files and changes. Committing nothing more than the process of adding the file to a local repository.

  • Later, add the files into the staging area and commit.
  • The additional step gives you control over the files and it will allow you to change the file if you choose the wrong file accidentally.
  • Check in the staging area by typing git status.
  • Now you can see our file below and the changes have not yet been committed.
  • To commit the file, use git commit -m “My First Commit”
  • If you made any mistake, open up the file, do the changes and proceed for another commit.

Analyse all Commits Made

  • If you want to recheck the commits, use git log. You can see the author name of the commit, committed date, commit message for every commit that was made.
  • If you want to check the commits done by a particular person use git log — author= author name.

Git Branches

You can create branches in GIT to keep your work separate from the master branch. These branches become handy while testing the codes. You will always work off the branch by default. These branches will help you to test the codes in test branches without disturbing other codes and branches. When we commit to testing branches, these checkpoints will keep them separate from the main branch. And if we like test branch codes, we can easily merge with the main branch.


Before merging the branches, be sure to review any changes you made between the branches using git diff test master. Move back your test branch(source branch) to the master branch and merge like

git checkout master

git merge test

Moving Code Between Local and Remote Repository

If you want to showcase your code to colleagues or the world, you can share it with anyone. Create a remote repository and synchronise it with your local repository. You can push the codes to a central location where other people can access your code. There are various websites for hosting GIT projects.


GIT gives various cool things to do, tagging is one of them. You can tag specific points in your commit history as being important like 1.0, 2.0, etc.

  • Lightweight tags – These are temporary tags that will be used for points to a specific commit.
  • Annotated tags – These are full-on objects which contain the tagger’s name, email id, date, message and verification of identity. In messages, customise it with your message.

Check the tags which you currently have, use the git tag. You can push tags to the remote repository, tag later points or delete them anytime.

See also  5 Ways to Alleviate eCommerce Shipping Worries Throughout the Holiday