Introduction To Git 📥📤

Introduction

In this DevOps series, we learn what version controlling system is VCS and source code management SCM. Version controlling system is Git and Source Code Management is GitHub. Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently.

What are VCS and SCM?

Let me go through an example. So, We are working on a project and there are 4 different types of developers.

Github

DEV A and DEV B are backend developers. DEV C is a UI developer and DEV D is a database developer. So, DEV A and DEV B started writing backend code using C#.Net, and VB.Net. DEV C started writing code using HTML, CSS, Javascript, Jquery Bootstrap, Angular, or React. DEV D started writing code or script using SQL Server, Oracle, and MySql DB. So, Everyone will keep their own files on their local machines. But I want the combined code of every developer in a single system instead of keeping individual files because it is a Web project. So, everything should be integrated with each other in one place. Here I will ask each and every developer to keep and manage their files in a central place called GitHub. So, once DEV A, DEV B, DEV C, and DEV D finish their code then they can place their code in GitHub. Finally, the code of every developer is saved in a central place called GitHub.

Let's understand SCM with a Scenario

In the above example, DEV A and DEV B are backend developers. So, DEV A created one file and kept it in GitHub, and in this same file DEV B wants to work.

In that scenario, B should not ask DEV A for permission because this file of DEV A is already present in a central place called GitHub. So, DEV D will take the code from GitHub keep modifications in this file as per the requirements, and then push the same file in GitHub. So, Again DEV A can pull the same file from GitHub whatever changes were made by DEV B earlier and DEV A makes some changes as per requirements and pushes this same file into GitHub.

Scenario

In this example you can see there is file File1.cs is created by DEV A and DEV A added one button functionality using C# code and kept it in GitHub. The same file DEV B pulled from GitHub and made one change in File1.cs he added the background color of the button and pushed the same file into GitHub. Again, DEV A pulled the same file File1.cs from GitHub and added one functionality that on the button click event added empty field validation using C#, and pushed the same file into a central place called GitHub. So, in this way, we manage a central place called Source Code Management. Here the operation for managing the source code is performed. So, GitHub is the most popular Source Code Management tool in the market.

Let's Understand VCS With Scenario

In the development life cycle, every developer will make some changes as per requirements. In certain scenarios what file has been pushed to GitHub by DEV A shows some defects. So, how to identify those defects or track the changes history made by each developer? This mechanism comes under VCS.

 Understand VCS

For example, DEV A has pushed the files to GitHub. So, here VCS will maintain a specific Version ID for that change made by DEV A. VCS every time maintains by generating Version ID for those who have done changes. So, after file changes made by DEV A, the VCS has one Version ID and the same file has been changed by DEV B, and the VCS has another Version ID. Every time VCS has a unique Version ID for each and every change.

VCS

Here you can see File1.cs has changed by DEV A and the VCS has generated a Version ID is 5678-EFGH-7890. The same file File1.cs was again changed by DEV B and the VCS generated a Version ID is 1234-ABCD-7890. Here you can understand the VCS has generated the unique Version ID for each change made by different developers or users. So, before and after changes of files called File1.cs made by DEV A and DEV B, the mechanism of version controlling is called VCS. Here every change will be tracked by VCS. Here Git is one of the popular Version Controlling System.

What is distributed Source code management?

Code Management

Here GitHub is the Distributed Source Code Management. For example, DEV A works at the USA location, DEV B works at the India location, DEV C works at the UK location and DEV D

works at the Srilanka location. Everyone can access GitHub remotely using internet access instead of a local machine. GitHub can be accessible by everyone remotely that's why it is called Distributed Source Code Management. So, DEV A has changed the file and the VCS has generated one Version ID. DEV B has changed the same file and VCS has generated another Version ID. This Version ID is generated by VCS is never the same and it will be unique each time even if DEV A and DEV B are from different locations with their local machines. That is the beautiful creation of VCS and SCM.

What is the location of SCM and VCS?

Here SCM is GitHub which resides at remote locations and VCS is Git which resides at each and every developer's local machines. Through Git we can connect GitHub. Please refer below image for a better understanding,

Remote Location

Let's know about the GitHub account

You can check the below URL to Sign in to GitHub. Here you can mention your input details as requested and you can create the GitHub account successfully. You will verify your GitHub account using the given email.

 GitHub account

After successful verification and creation, you will get the interface as mentioned below.

Creation

Create a new repository using GitHub

New repository

When I createa new repository, It is asking for the repository name and description of therepository. Also, type ofrepository whether Public or Private.Initialize this repository by adding a README file. If we do not select anyone of the checkbox list names then it will create an empty repository for us.

After the successful creation of my new repository, the interface will be shown below.

FirstRepo

Uses of repository using GitHub

So, Here I will connect this repository of GitHub from my local laptop using Git and transfer some files from my local repository to the remote repository that FirstRepo created on GitHub (SCM) using Git (VCS). After that I take the files from this remote repository to my local system.

Local system

Here you can see DEV B has pushed some files from the local machine using Git to the remote repository FirstRepo which is created on GitHub. Here Git resides in a local machine and GitHub resides in the remote system. In this way, we can perform a pull and push files mechanism between the local machine to remote repository and vice-versa using Git and GitHub.

Summary

In this article, we have learned.

  • What areGit and GitHub.?
  • What are SCM and VCS.?
  • Steps to create a GitHub account and create a new repository
  • What are the uses of the GitHub repository.?


Similar Articles