Hasura Internship: Task 2.2

Hello all, this is the fourth blog in Hasura internship’s blogs series. This blog is for Task 2.2. In this blog I will write about Git. So let’s git started.

What is Git ?

Git is a free and open source Distributed Version Control System. Since it is distributed so anybody can work on the same code simultaneously and make changes. Version Control System (VCS) is the management of any changes to documents, computer programs, large websites and other collection of information. Basically, VCS keeps the record of different versions of your document, source code et cetera. Through which we can get any previous versions of our code or if anything gone wrong then we can just rollback to the last version. We can also compare between different versions of our code which gives clarity as to in which direction we are developing what should be corrected. VCS are of two types:

  • Centralized Version Control System (CVCS)
  • Distributed Version Control System (DVCS)

Centralized VCS:

Image Credit: https://git-scm.com/book/en/v2/images/centralized.png

In Centralised VCS, there is a single server that everybody is using. All the versions of the files are stored in this central server only and everybody is working directly on that server remotely. The drawbacks of this VCS are that the local user should always be connected to the internet in order to work in centralised VCS and also the major one is that since everything is stored at a single place i.e. Central VCS Server, if anything goes wrong there like server goes down for some time then no work can continue their work for that time or even worse if hard disk of central server gets corrupted and proper backup has not been kept then all the information or versions of files gets lost and that’s where Distributed VCS comes into picture.

Distributed VCS:

Image Credit: https://git-scm.com/book/en/v2/images/distributed.png

In Distributed VCS, the versions of files not only stored in the central server but also it’s copy is present in all the clients connected to it and thus if there is a breakdown on the server side then the files can be recovered through any of the clients. It is also faster than CVCS as here all the changes are done in the repository stored in local machine and then they are bundled and pushed to the central server in contrary to CVCS where every single changes is done directly to the server which takes more time. Git is a Distributed VCS.

Basic Workflow of Git:

Image Credit: Google

The above diagram shows the basic architecture of Git. Workspace is the the working directory in which you are doing changes to your work, Staging area is the area between workspace and local repository like a temporary area to store your changes. You can infer form the diagram that by running several command the changes can travel from your workspace to the remote repository through staging area and local repository and vice verca i.e. you can travel to any stage and get back as well.

Why is Git useful ?

  • It helps to manage large amount of code.
  • It helps a team to collaborate more efficiently over a project and see each other work.
  • It is also useful in case of any error in the code, so that the user can go back to previous saved version of that code.
  • It helps in retreiving deleted files by going back to previous commit.
  • Users can also compare between different versions of code.

Here are some of the resources available to know about git in detail:

Hope this helps. Thank You :)