2.2) Learn git

As we start with name Learn git first question comes into mind is that what is git? and why should I learn it?

What is git?

Git is a free and open source distributed version control system(VCS) designed to handle everything from small to very large projects with speed and efficiency.

On a very basic level, there are two awesome things a VCS allows you to do: You can track changes in your files, and it simplifies working on files and projects with multiple people. There are multiple Version Control Systems, but Git is by far and large the most popular — both for individual and company use.

For example, if you have a file on which you’ve been working on and reworking for a long time, all the versions of it are saved in Git, and you can easily get back to every version.

Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Some of the basic operations in Git are:

  1. Initialize
  2. Add
  3. Commit
  4. Pull
  5. Push

Some advanced Git operations are:

  1. Branching
  2. Merging
  3. Rebasing

Take a look at the architecture of Git below:

git Architecture

now second question comes

Why is git useful?

There are many tools available in market right now like Git to Revision control System, CVS and SCM (source code management)like bitbucket but why Git is most popular ? Well the reasons are:

Version Control

Every version of your code is always available to you. Git doesn't work the same way as saving in notepad++ or any IDE like Sublime Text which saves the last version only. With Git, every time you commit your code, Git remembers what has changed since the last time you saved your code. Even if you've changed a file 10k times, Git will remember each and every change. Need to revert back to any time on a project for some reason? Git makes it easy to revert to that time. So every version is always available if any mistake happens it would get fixed by reverting back with git.

Backup for your code

You are always having the backup for your code on centralized remote server. If anything happens to your laptop or your laptop get lost or your hard drive get failed. Then in all the cases your code is always with you. It may be the case that you visited some place and you want to show off your skill to someone but you didn't brought your laptop then git will help to have access to that code.

Makes Team Work Easy

Git simplifies the process of working with other people and makes it easy to collaborate on projects. Team members can work on files and easily merge their changes in with the master branch of the project. This allows multiple people to work on the same files at the same time.

Small and Fast

Git is fast. With Git, nearly all operations are performed locally, giving it a huge speed advantage on centralized systems that constantly have to communicate with a server somewhere.

Git was built to work on the Linux kernel, meaning that it has had to effectively handle large repositories from day one. Git is written in C, reducing the overhead of runtimes associated with higher-level languages. Speed and performance has been a primary design goal of the Git from the start.

Data Assurance

The data model that Git uses ensures the cryptographic integrity of every bit of your project. Every file and commit is checksummed and retrieved by its checksum when checked back out. It’s impossible to get anything out of Git other than the exact bits you put in.

It is also impossible to change any file, date, commit message, or any other data in a Git repository without changing the IDs of everything after it. This means that if you have a commit ID, you can be assured not only that your project is exactly the same as when it was committed, but that nothing in its history was changed.

Staging Area

Unlike the other systems, Git has something called the “staging area” or “index”. This is an intermediate area where commits can be formatted and reviewed before completing the commit.

One thing that sets Git apart from other tools is that it’s possible to quickly stage some of your files and commit them without committing all of the other modified files in your working directory or having to list them on the command line during the commit.

Staging Area Working

This allows you to stage only portions of a modified file. Gone are the days of making two logically unrelated modifications to a file before you realized that you forgot to commit one of them. Now you can just stage the change you need for the current commit and stage the other change for the next commit.

Free and Open Source

Git is released under the GNU General Public License version 2.0, which is an open source license. The Git project chose to use GPLv2 to guarantee your freedom to share and change free software — -to make sure the software is free for all its users.

Recommended Resources to learn git:

Firstly I learned from the this link which was provided on Hasura Internship Tasks sheet which was good for beginner to learn which is a course on codeschool website.

Secondly you can learn it from git documentation which is detailed explanation of git.

And for more learning you can use Git and GitHub learning resources.

In my next blog I will explain about Setup hasura/local-development.

Thanks for reading. If you like it please hit heart button.

Previous Next