Why developer need Git?
Tags: git
Published: 2023-02-15 02:07:01

Git, git and git again...

What is this git? why do we as developer should be mastering this technology? so what if we don't use git? will there be a natural disaster 😓

Let's take at least 5 minutes to understand why we use git here.

So let's go.....

## Before git created

Git was created by Linus Torvalds in 2005 with the aim of recording every version (change) of Linux, as it is known that git was created by him at the same time as the creation of the Linux kernel.

A project will definitely be done by several people with different tasks, some are working on features A, B, C and bla bla. So the question arises, how can a group work together in working on a project ❓

There are several options used by several teams working on a project before git existed.

- use a flashdisk
- take turns working on the same computer
- send any changes by any intermediary
- and various other complicated methods

For example, a team will work on project A with 3 members.

Before git they would have worked with the following method, sorry I'm using an analogy in the form of diagrams, because I can't make good design 😅


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfb9v92mk066k0yhawiz.png)

From the flow above, we can see how a team with many members works on a project.

In the flow above there are 3 people namely, Andi, Jaka and Rizki where these three people will definitely work on different features.

In a project (before there was git) we would definitely have a role that would review any changes submitted by team members. From the flow above, Jaka is the one who acts as a reviewer as well as the main project holder, if in git Jaka's role is to manage the main branch.

_**Jaka's job**...._

Jaka's job is that he must check the code sent by other members, whether changing the code will not result in an error when the program is run, is it as expected or not.

If the changes sent by members have been reviewed by Jaka and the changes are okay, then jaka will merge the code into the main work, this is often referred to as **merge** in git.

Flow like that is what a team will do repeatedly until the project is finished, each team will send their changes to main (Jaka), Jaka will check these changes and he will combine them into the main work.

This flow is actually commonplace to do, but when we face complex projects, we will definitely experience some very troublesome problems if we have to solve it with a flow like this.

For example Jaka deleted some codes but at one point it turned out that the code was needed again...

Now the only way is, Rizki and Andi have to copy the files for every change that he will send to Jaka. Imagine if there were 1000 changes made by them, of course he would also copy the edited files for 1000 😩

So therefore Git created, one of the VCS software (Version Control System). From the name alone, surely we already know that git is used to control the version of a system, are you still confused? ok let's discuss git directly 😊

## Git and it's functions

We can solve the previous problem with git, how? ok let's discuss.

**Replacing Jaka's role with branch**

Jaka's role here is the one who has control over the main work, he who checks the code sent by other members, he who will deploy the application in the end, and so on.

In git we can find the term Branch, where everyone must have their own branch, and each branch has different tasks.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3ox6tm3pqrb35x15dd0.png)

**Saving changes with staging area**

Git has 3 areas, namely the working area, staging area, and repository.

The working area is the folder where you are currently working, the staging area is an area where you can save the changes you made before. By entering our files into the staging area, we will be able to track our files further for any changes we make.

This can replace the manual method of copying files every time you make a change.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58971fq294axctphbeq4.png)

## Closing

Okay, that's all for this article, I hope you can understand better why and what are the reasons we use git. In the next article I will discuss about Git technology in depth, starting from commit, pull, branch, and merge.

See you in the next article 🔥