What Is Git?
By: Ridho Perdana
Tags: Software Development, Software Engineer, Git, Github, Coding

Do you want to jump into coding? Then, after you learn about the code you must learn about Git, and here’s a brief story about it.

Photo by Chris Ried on Unsplash

History

Git is created by Linus Torvalds when he is developing the Linux Kernel. It happened when BitKeeper, the previous Linux Community’s version control revoke its free use. At that time, the community also feel that they needed a new version control system. Then Linus went “off” from work for a week to wrote Git. He wrote Git by taking the plus point from BitKeeper and some other improvements.

What is Git?

To make it short, Git is an Open Source Distributed Version Control. It is a tool that can help us, developers, to write trackable code concurrently with anybody from anywhere for free.

Distributed Version Control

Just like its name, version control is a tool that can track the version of code that had been written by developers. Developers can track and manage their source code’s progress with this version control, so if something bad happens they can see or even revert to the previous version. The distributed means that the source code itself can be everywhere, any developers inside a team can “download” the code and “upload” it when they have finished the job.

Concurrently

Photo by Annie Spratt on Unsplash

When I first learn coding at school and have a project with some people, I need to wait for the other people to finish their job, and then I’ll be able to download the code to continue the work. That kind of process made the project take a longer time to finish and also have more error-prone since anyone can accidentally delete or replace existing code.

Using Git can overcome that process. The team just need to define and do their individual task, download the current version of the code, and upload the code after they finished the job inside their own folder. After uploading the code, the uploader can ask to merge their version of the code into the main folder and everyone else can review the changes with only knowing the code differences.

Free

Because Git is an Open Source Software, so it can be used by anyone without spending any money.

Features

Here are some basic features that you need to know about Git

Repository

Git with its data is stored inside a Repository. We can say that the repository is the folder of your code. This repository is hosted on a server. Some popular services that host a Git Repository are Github, Gitlab, and Bitbucket.

Branch

Photo by Gilly Stewart on Unsplash

Git uses a tree structure for the data. When we upload our data into the server, it will be stored inside the master branch of the tree on that particular repository. So in other words, the branch is the sub-folder of our repository.

Commit Hash

This is the main feature that makes Git able to track our changes to the data. When we are done with writing the code, we need to mark it as done with adding a commit before pushing into a target branch. Git’s commit will be formed as a Hash text that contains several data, which are:

Content. All of our code changes will be added to the commit hash data. Commit date. Name and email of the person who commits the code. Message. You have to make sure that everyone else understands what you have done to the code, so the commit message is also appended to the hash value. Previous commit hash value. This is how Git can track and maintain the code. Every commit has the previous commit’s identifier so it can find the previous condition of our code.

Push and Pull

Both of these are the terms for upload and download in Git’s world. You don’t have to be confused when hearing a developer said, “I have pushed my work” or “I need to pull the latest version from the feature branch”.

Pull Request

After pushing your changes into a certain branch on the git repository, you need to ask your teammate to join or merging the changes. This process is handled inside the Pull Request feature. Using a Pull Request will notice your teammate about your work, from the previous code and the new code that you have been modified.

Tips for using Git

Photo by Glenn Carstens-Peters on Unsplash

Using Git correctly can improve the development process. As far as I know, there is no absolutely correct way to use Git. By having more experience with it can help you use Git the best way it could. From me, I’ve got 2 tips that I always share with my friend which are new to coding.

Give a Clear Commit Message

When you decide to use Git, it means you will not work alone. To make sure that other people understand what you do, you need to give your commit message a very clear message. You can follow a commit message style like this one https://karma-runner.github.io/2.0/dev/git-commit-msg.html or if you want to create your own standard, you can discuss it with your teammate.

Create and Decide a Git Flow

This is an advanced topic because deciding the best git-flow for your team project is a difficult task. Git flow is the way you use branch and other git functions to help development, bug fixing, and deployment better. But for a starter, I suggest you see this Gitflow https://datasift.github.io/gitflow/IntroducingGitFlow.html.