Introduction To Git 📥📤

Introduction

 
In this DevOps series, we learn what version controlling system as VCS and source code management as 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 is VCS and SCM

 
Let me go through an example. So, We are working in a project and there 4 different types of developers.
 
 
DEV A and DEV B are backend developer. DEV C is UI developer and DEV D is database developer. So, DEV A and DEV B started writing backend code using C#.Net, VB.Net. DEV C started writing code using Html, CSS, Javascript, Jquery and Bootstrap, Angular or React. DEV D started writing code or script using SQL Server, Oracle, MySql DB. So, Everyone will keep their own files in their local machines. But i want combined code of every developers in a single system instead of keep individuals files because it 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 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 developers are saved in central place called GitHub.
 

Let's Understand SCM With Scenario

 
In above example DEV A and DEV B are backend developers. So, DEV A created one file and kept in GitHub and in this same file DEV B wants to work.
 
In that scenarioDEV B should not ask to DEV A for permission becuase this file of DEV A is already present in central place called GtHub. So, DEV D wll take the code from GitHub and keep modification in this file as per the requirements and then push the same file in GitHub. So, Again DEV A can pull same file from GitHub whatever changes made by the DEV B earlier and DEV A make some changes as per requirements and push this same file into GitHub.
 
 
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 in GitHub. The same file DEV B pull from GitHub and make one change that in File1.cs he added background color of the button and push the same file into GitHub. Again, DEV A pull same file File1.cs from GitHub and add one functionality that on button click event added empty field validation using C# and push the same file into 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 popular Source Code Management tool in the market.
 

Let's Understand VCS With Scenario

 
In the development life cycle every developer will do some changes as per requirements. In certain scenario 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 developers. This mechanism comes under VCS. 
 
 
For example, DEV A has pushed the files to GitHub. So, here VCS will maintain a specific Version ID for that changed made by DEV A. VCS everytime maintains by generating Version ID for those who has done changes. So, after file changes made by DEV A, the VCS has one Version ID and the same file has changed by DEV B, the VCS has another Version ID. Everytime VCS has unique Version ID for each and every changes.
 
 
Here you can see File1.cs has changed by DEV A and the VCS has generated an Version ID is 5678-EFGH-7890. The same file File1.cs was again changed by DEV B and the VCS generated an Version ID is 1234-ABCD-7890. Here you can understand the VCS has generated the unique Version ID for each changed made by different developers or users. So, before and after changes of file called File1.cs made by DEV A and DEV B, the mechanism of version controlling is called VCS. Here every changes will be tracked by VCS. Here Git is one of the popular Version Controlling System.
 

What is Distributed Source Code Management

 
 
Here GitHub is the Distributed Source Code Management. For example DEV A works at USA location, DEV B works at India location, DEV C works at UK location and DEV D
works at Srilanka location. Everyone can access GitHub remotely using internet access instead from local machine individually. GitHub can be accessible by everyone remotely thats 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. These Version ID is generated by VCS is never same and it will be unique each time even 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 location and VCS is Git which resides at each and every developer local machines. Through Git we can connect GitHub. Please refer below image for better understanding,
 
 

Let's know about GitHub account

 
You can check below URL to Sign in to GitHub. Here you can mention your input details as per asked and you can create the GitHub account successfully. You will verify your GitHub account using the given mail-id.
 
 
After successful verification and creation you will get the interface as mentioned below,
 
 

Create a new repository Using GitHub

 
 
When i create a new repository, It is asking for repository name, Description about the repository. Also type of repository whether Public or Private. Initialize this repository with by adding a README file. If we not select anyone of the checkbox list names then it will create a empty repository for us.
 
After successful creation my new repository the interface will be shown as below,
 
 

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 remote repository that FirstRepo created on GitHub (SCM) using Git (VCS). After then I take the files from this remote repository to my local system. 
 
 
Here you can see DEV B has pushed some files from local machine using Git to remote repository FirstRepo which one is created on GitHub. Here Git resides in local machine and GitHub resides in remote system. In this way we can perform pull and push files mechanism between local machine to remote repository and viceversa using Git and GitHub.
 

SUMMARY

 
In this article, we have learned,
  • What is Git and GitHub
  • What is SCM and VCS
  • Steps to create GitHub account and create new repository
  • What is the uses of GitHub repository