Day9/90days of DevOps Challenge-Deep Dive in Git & GitHub for DevOps Engineers

Day9/90days of DevOps Challenge-Deep Dive in Git & GitHub for DevOps Engineers

Welcome to Day 9 of the #90DaysOfDevOps challenge. Today, we will take a deep dive into Git & GitHub, two essential tools in the DevOps ecosystem. We will explore the importance of Git, understand the difference between the main branch and master branch, and clarify the distinction between Git and GitHub.

What is Git, and why is it important?

Git is an open-source distributed version control system. It is designed to handle minor to major projects with high speed and efficiency. It enables you to collaborate more easily with other developers. Git can automatically merge the changes, so two people can even work on different parts of the same file and later merge those changes without losing each other’s work!

Git is so important,

  • Track your changes and revert back if necessary

  • Open Source Contribution

  • Distributed development

  • Collaboration with Feature branching

It runs more quickly. Both the server as well as local operations are performed easily with high speed.

What is the difference between Main Branch and Master Branch?

In Git, the term Master used to be the default branch name. However, in recent years, the term has been considered problematic, as it carries unnecessary historical and potentially insensitive connotations. Many organizations have switched to using more neutral terms like Main as the default branch name.

The purpose of this branch remains the same: it serves as the primary branch where the stable and production-ready code resides. Many projects and organizations, including major platforms like GitHub and GitLab, have adopted "main" as the default branch name or have made it an option for new repositories.

Difference between Git and GitHub?

  1. Git:

    • Git is a distributed version control system (VCS) designed to track changes in source code during software development.

    • It allows multiple developers to work on the same project simultaneously, making it easier to manage and merge changes.

    • With Git, developers can create branches, commit changes, merge code, and revert to previous versions of files.

    • Git operates locally on a developer's machine, providing a complete copy of the repository, including the entire history of changes.

    • It is a command-line tool but also has various graphical user interface (GUI) clients available.

  2. GitHub:

    • GitHub is a web-based hosting service and collaboration platform built on top of Git.

    • It provides a centralized location for hosting Git repositories, making it easier to collaborate with other developers.

    • Developers can push their Git repositories to GitHub and access them from anywhere with an internet connection.

    • GitHub offers additional features such as issue tracking, pull requests, code reviews, project management tools, and integration with other services.

    • It allows developers to clone, fork, and collaborate on existing projects, as well as showcase their own work through personal repositories.

How do you create a new repository on GitHub?

Follow the below steps to create a new repository on GitHub:

  • Log in to your GitHub account.

  • Click on the "New" in the top left corner and create "New Repository."

  • Name your repository "devops" and add an optional description

  • Choose the repository's visibility (public or private).

  • If you want to initialize this repository, Click on Add README file

  • Click on "Create Repository." you're done! now have a new repository on GitHub.

    What is the difference between a local and a remote repository? How to connect them?

    Local repository:

  • The local repository is a Git repository that is stored on your computer.

  • It allows developers to work offline, experiment with different ideas, and maintain a private workflow

  • Flexibility is particularly useful in situations where internet access is limited or unreliable.

    Remote repository:

  • The remote repository is a Git repository that is stored on some remote computer.

  • It enables team members to synchronize their changes and provides backup and visibility for the project

  • The remote repository facilitates collaboration and acts as a central point of synchronization, allowing team members to merge their changes and resolve conflicts if necessary.

connect local repository with Remote repository:

  • Open your Git Bash and navigate to the repository that needs to be linked

  • Check if the repository is clean and nothing is outstanding by using git status command.

  • Add command git remote add origin <name> <repository url> and click enter

  • Done, the local repository will be linked to the GitHub repository.

  • Now you can push the changes in your remote repository from your local repository

    Task 1:

    Set your user name and email address, which will be associated with your commits.

    To set your user name and email address we used the git command:

      git config --global user. name "username"
      git config --global ""

    Task 2:

    Create a repository named "Devops" on GitHub

Task 3:

Connect your local repository to the repository on GitHub.

Create a new file in Devops/Git/Day-02.txt and add some content to it.

Push your local commits to the repository on GitHub

Thank you, for reading my blog. Share your thoughts and experiences in the comments below.