Day 8 Task: Basic Git & GitHub for DevOps Engineers.

Day 8 Task: Basic Git & GitHub for DevOps Engineers.

🖊️What is Git?

Git is an open-source distributed version control system. It is designed to handle minor to major projects with high speed and efficiency. It is developed to coordinate the work among the developers. The version control allows us to track and work together with our team members at the same workspace

🖊️What is Github?

GitHub is a web-based platform that provides hosting for version control using Git. It is a subsidiary of Microsoft, and it offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its features.

GitHub is a Git repository hosting service. GitHub also facilitates many of its features, such as access control and collaboration. It provides a Web-based graphical interface. GitHub is an American company. It hosts the source code of your project in the form of different programming languages and keeps track of the various changes made by programmers.

🖊️What is Version Control? How many types of version controls we have?

Version control is a system that tracks changes to a file or set of files over time so that you can recall specific versions later. It allows you to revert files to a previous state, revert the entire project to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more.

There are two main types of version control systems: centralized version control systems and distributed version control systems.

Central Version Control System (CVCS)

In CVCS, the central server stores all the data. This central server enables team collaboration. It just contains a single repository, and each user gets their working copy. We need to commit, so the changes get reflected in the repository. Others can check our changes by updating their local copy.

Distributed Version Control System (DVCS)
In DVCS, there is no need to store the entire data on our local repository. Instead, we can have a clone of the remote repository to the local. We can also have a full snapshot of the project history.

The User needs to update for the changes to be reflected in the local repository. Then the user can push the changes to the central repository. If other users want to check the changes, they will pull the updated central repository to their local repository, and then they update in their local copy.

🖊️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.

Task 1: Install Git on your computer (if it is not already installed). You can download it from the official website at git-scm.com/downloads

To install it with the Ubuntu

#to Install git
sudo apt install git

#to check if it installed or not
git --version

Task 2: Create a free account on GitHub (if you don't already have one). You can sign up at

Task 3: Learn the basics of Git by reading through the video This will give you an understanding of what Git is, how it works, and how to use it to track changes to files.

  1. Repository (Repo): A repository is a central database where all versions of a project's code are stored. It contains the complete history of changes, known as commits. Git can handle multiple repositories, including local repositories on your development machine and remote repositories on servers like GitHub, GitLab, or Bitbucket.

  2. Commit: A commit represents a snapshot of the changes made to the project at a specific point in time. Each commit has a unique identifier (SHA-1 hash), author's name, email, timestamp, and a commit message describing the changes made. Commits allow developers to track the history of the project and revert to previous versions if needed.

  3. Branch: A branch is a separate line of development that allows developers to work on different features or bug fixes independently. The main branch is typically called "master" or "main," and new branches are created from it. Developers can merge branches back into the main branch when the work is complete.

  4. Clone: Cloning is the process of creating a copy of a remote repository on your local machine. It allows you to work on the project locally and push changes back to the remote repository when ready.

  5. Pull: Pull is used to update your local repository with the latest changes from a remote repository. It combines the "fetch" (download changes) and "merge" (apply changes) operations into one command.

  6. Push: Push is used to upload your local commits to a remote repository. It updates the remote repository with the changes you've made locally.

  7. Fetch: Fetch is used to download changes from a remote repository without automatically merging them into your local branch. It allows you to review changes before merging them.

  8. Merge: Merge combines changes from one branch into another. It is used to integrate changes from a feature branch back into the main branch.

  9. Pull Request (PR): In collaborative development, a pull request is a request to merge changes from a branch into the main branch. It allows team members to review the changes before merging.

  10. Remote: A remote is a reference to a repository located on a server, such as GitHub or GitLab. It allows developers to collaborate with others by pushing and pulling changes to and from the remote repository.

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

Creating a new repository (repo) on GitHub is a straightforward process. Here are the steps to create a new repository:

  1. Log in to GitHub: If you don't have a GitHub account, sign up for one at github.com/join. If you already have an account, log in using your credentials.

  2. Go to Your GitHub Dashboard: After logging in, you will land on your GitHub dashboard.

  3. Create a New Repository: In the top-right corner of the GitHub dashboard, click on the "+" icon, and then select "New repository" from the dropdown menu.

  1. Fill in the Repository Details: On the "Create a new repository" page, you will need to provide the following details:
  • Repository name: Choose a name for your repository. It should be descriptive and relevant to your project.

  • Description: Optionally, add a short description of your repository.

  • Visibility: Choose whether the repository will be public (visible to everyone) or private (accessible only to collaborators you invite).

  • Initialize this repository with You can choose to initialize the repository with a README file, a .gitignore file, or a license. These files are essential for most projects.

  • Add .gitignore: Select the programming language or framework you are using, and GitHub will generate a .gitignore file that excludes unnecessary files from version control.

  • Choose a license: Select an open-source license for your project. It's a good practice to choose a license that suits your project's requirements.

  1. Create the Repository: Once you've filled in the details, click the "Create Repository" button. Your new repository will be created, and you'll be redirected to its page.

  2. Set Up the Repository: On your repository page, you'll find the repository's URL, which we have to clone the repository to your local machine using Git. we can also customize the repository's settings, add collaborators, and manage various aspects of the repository from this page.

  3. Clone the Repository: To start working on your project locally, we have to clone the repository to our local machine using the git clone command. The repository URL is available on the repository page.

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

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

conclusion-GitHub is a powerful platform that revolutionizes the way developers collaborate, manage, and share their code. It serves as a centralized hub for version control, allowing teams to work together seamlessly on projects of any size.

If you find my blog valuable, I invite you to like, share, and join the discussion. Your feedback is immensely cherished as it fuels continuous improvement. Let's embark on this transformative DevOps adventure together! 🚀 #devops #90daysofdevops