Git is very important and powerful tool when it comes to the software development life cycle. Now in this article, we are going to see why git is used vastly in the software industry and what kinds of operations we can perform with git. So git is basically a distributed
version control system for tracking changes in source code during software development. Git is designed for coordinating work among developers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
Git uses a version control system in which at some instances in a project a snapshot of the project is taken that is the progress made by that project is stored on a central repository. In simple words suppose the user is developing a web page first it will add its name and stored it as version then it added basic info and stored it as the second version then it added its profile picture and stored it as the third version now suppose the user added a wrong profile picture then there is always an option to revert back to the previous version after that it can add the correct profile picture.
Advantages of Version Control System
- Storing Versions: As explained in the above example If we encounter some error in our project code we always have the option to revert back to the previous version with the help of git it is easy to store version. If we try to store them manually It will be a hard task.
- Collaboration: In the software industry, multiple employees are working on the same project so with the help of version control system the main copy is stored on central remote server fetched by employees and after changes which are to be made are made employee uploads its own version to the central repository so others can fetch code updated by employees.
- Backup: In case if a central repository is crashed then anyone can push its local copy to the central server. As while making changes it has to be made on the local repository.
Git can be used with
GUI as well as command-line. In this article, we are going to use the command line.
GIT can be downloaded from
here. After the successful installation of GIT, there is a need to configure git using the following commands:
- Open terminal:
git --version
To check version of git
-
To set your username
git config --global user.name "FIRST_NAME LAST_NAME"
-
To set your email
git config --global user.email "[email protected]"
Working with GIT commandline
Initializing a local repository:
git init
This command will initialise our local repository.

Now our repository is initialized we can add some code to our project
Checking status of the repository:
As you can see a
.git file is created as mentioned above. Now to check the status of these files, the following command is used:
git status
Here, working area is where files that are not added to repository yet are stored. These files are called as
'untracked files'. Staging area is files that are going to be a part of the next commit. Commit means basically storing a version of project at the current instance. As you add new files in your workspace you can add this files to staging area using
git add command.
Adding files to the repository:
Now in the previous step we have seen that some files are untracked, with the help of git add filename we add these files to the staging area.
git add command is used to add all files in the folder to the staging area
git add

After adding files to the staging area if git status is called again, then it will show files to be committed.
Committing changes:
Now files are ready to be committed they are ready to be added to the local repository
git commit -m "your message"
git commit command allows you to add your files to your local repository
-m specifies that you have to pass commit message while committing a code

Every time a commit is made a
SHA-256 key is created and assigned to that commit If we wanted to retrieve code at that commit it is possible using this id.
Accessing log of commits:
After you have created several commits, or if you have cloned a repository with an existing commit history, you’ll probably want to look back to see what has happened. That's where git log comes in picture. This command allows us to see all commits made by user. With the help of commit id you can refer back to the previous version.
git log
Additional commands
git clone "Remote_repo_url"
With the help of git clone command, you can clone various repositories that are present on websites like GitHub, GitLab, bitbucket, etc.
Any repository can be cloned as follows:
git clone "https://github.com/sanketpathak64/Kickstarter-Campaign.git"
Parallel development commands
git branch branch_name
This command allows to create a branch for the project. A branch is like exact copy of the project.
git checkout branch_name
This command allows to switch from one branch to another.
git merge branch_name
This command allows to merge a code of 2 branches in one branch.
Similar Reads
Non-linear Components
In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
Class Diagram | Unified Modeling Language (UML)
A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Spring Boot Tutorial
Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Backpropagation in Neural Network
Backpropagation is also known as "Backward Propagation of Errors" and it is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network. In this article we will explore what
10 min read
AVL Tree Data Structure
An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. The absolute difference between the heights of the left subtree and the right subtree for any node is known as the balance factor of
4 min read
What is Vacuum Circuit Breaker?
A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac
13 min read
Polymorphism in Java
Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca
7 min read
3-Phase Inverter
An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power
13 min read
Random Forest Algorithm in Machine Learning
A Random Forest is a collection of decision trees that work together to make predictions. In this article, we'll explain how the Random Forest algorithm works and how to use it.Understanding Intuition for Random Forest AlgorithmRandom Forest algorithm is a powerful tree learning technique in Machine
7 min read
What is a Neural Network?
Neural networks are machine learning models that mimic the complex functions of the human brain. These models consist of interconnected nodes or neurons that process data, learn patterns, and enable tasks such as pattern recognition and decision-making.In this article, we will explore the fundamenta
14 min read