Git & GitHub for DevOps Engineers | Part 1

Git & GitHub for DevOps Engineers | Part 1

Day08 - #90daysdevopschallenge

ยท

4 min read

Before starting to learn about GIT & Github. It's required to know why these tools come into the picture. What is the reason for creating these tools? so firstly start with Version Control System(VCS).

Version Control System:

Version Control Systems are tools that help people to track changes made to their documentation. It tracks the history of the project, allowing it to compare different versions and revert to earlier versions if necessary.

VCS allows multiple people to collaborate on the same project. Multiple users can work on different parts of the same project simultaneously and at the end merge all these changes into a single version.

In this world, two types of VCS exist: Distributed Version Control System & Centralized Version Control System

Centralized Version Control System:

In this system, there is a single central repository that stores the entire history of the project. The developer clones a working copy of this repository to their local machines, makes changes, and then pushes those changes back to the central server. Example: SVN(Subversion), Helix Core

Distributed Version Control System:

In this system, Developer has a full copy of that repository, including its entire history, on their local machine. after creating a full copy in the local machine, can work offline, committing changes to their local repository. After that, by pushing and pulling they can synchronize their changes.

Example: Git, Bitbucket, Mercurial

Choosing the Right VCS for your Project:

When you have small teams and your organization requires centralized control over access and changes then use CVCS and when you have large & complex projects or distributed teams then choose DVCS.

Why we use distributed version control over centralized version control:

  1. Better collaboration: In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don't have to constantly communicate with a central server to commit their changes or to see the changes made by others.

  2. Improved speed: Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don't have to communicate with a central server.

  3. Greater flexibility: With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.

  4. Enhanced security: In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to data loss. If the central server in a CVCS goes down or the repository becomes corrupted, it can be difficult to recover the lost data.

Now Let's start Git and Github.

GIT:

GIT stands for "Global Information Tracker". It is a powerful distributed version control system that allows you to track changes in the source code and also enables multiple people to work together on the same project.

Github:

GitHub is a web-based platform that provides hosting on Git. It's a very popular platform for developers to store, share and collaborate on code with other developers. It provides multiple features, integrations, and collaborations.

Tasks:

Task1: Install Git in your system

You can install Git in your system locally because it's software. You can download it from the official website at Install Git.

Task2: Create a Free Account on GitHub

You can't install it on your system because it's a service, you can use that service so for this required to create an account on the official platform signing on GitHub.

Exercises:

Exercise1: Create a new repository on GitHub and clone it to your local machine

Step 1: Go to your GitHub Account and click on your profile icon.

Step 2: Select the option "Your Repositories" then select "New". Now give the repository name according to your requirement. then click on "Create Repository".

Exercise 2: Make some changes to a file in the repository and commit them to the repository using Git.

Before making changes in the file, required to copy this into the local system.

after taking a clone go inside your repository and make some changes to existing files or you can create a new file. In my case, I created a new file.

After making changes, add these changes and commit all these changes.

Exercise 3: Push the changes back to the repository on GitHub:

Now push the changes into Git Hub.

Verify file "test2.txt" push inside the repository.

In Next Article will read more about Git & github...

Thank you for giving your precious time to read this blog/article and if any suggestions or improvements are required on my blogs feel free to connect on Linkedin Unnati Gupta.

ย