Git and GitHub for DevOps Engineers

Git and GitHub for DevOps Engineers

In the world of software development, collaboration and version control are paramount. Git and GitHub are tools that help developers manage code versions and collaborate with others. They are essential for building projects. These two tools are essential for modern software development, helping developers manage code efficiently, collaborate seamlessly, and track changes effortlessly.

Git is a version control system that tracks code changes. It was created by Linus Torvalds in 2005. On the other hand, GitHub is a cloud-based service that helps developers store and manage code. It also provides tools for collaboration.

GitHub allows developers to host their files in a "Git Repository". Other people can collaborate on projects, whether they are open source or closed for specific colleagues.

Now let's look more into the Git and GitHub universe and explore their significance.

What is Git?

Git is a distributed version control system (VCS) that helps developers track and manage changes to their code during software development. Git allows multiple developers to collaborate on a project, enabling them to track changes, work on separate parts of the codebase simultaneously, and merge their changes seamlessly.

Importance of Git

Let's understand why using Git is important

  1. Combining Everyone's Work: Git is like a superpower that allows your team to effortlessly merge everyone's contributions, just like expertly combining various ingredients to create a flawless cake where each element seamlessly melds together.

  2. Keeping Things Organised: Think of Git as a virtual notebook, meticulously documenting every change made to your project. It's like possessing a magical book that not only reveals who did what, when, and why but also helps you grasp the project's evolution and keeps everything impeccably organized.

  3. Better Teamwork: Git grants each team member their unique project copy, allowing them to work independently. Think of it as having your private playground for testing ideas without disrupting others. When it's time to showcase your progress to the team, sharing your changes with them is a breeze.

  4. Avoiding Mistakes: Consider Git as a time-travel tool for your project. If you make a mistake, you can effortlessly return to a point when everything is running smoothly. Say goodbye to worrying about errors!

  5. Flexibility in Any Location: Git empowers you to continue project work even when you're offline. You can make modifications and store them locally, and once you're reconnected to the internet, seamlessly share your progress with others.

What is GitHub?

GitHub is a web-based platform centered on Git, serving as a central hub where developers can host, collaborate on, and oversee Git repositories. Imagine it as a social network designed for developers, but with a primary focus on code sharing and management.

Key feature of GitHub:

Of course, here are the key features of GitHub in 5-6 points:

  1. Version Control: Offers powerful Git-based version control for tracking code changes.

  2. Repository Hosting: Provides a platform to host and manage Git repositories online.

  3. Collaboration Tools: Facilitates collaboration with features like issue tracking and pull requests.

  4. Code Review: Enables peer code review through pull requests for quality assurance.

  5. Continuous Integration: Supports CI/CD pipelines with GitHub Actions for automated workflows.

  6. Community and Social Network: Fosters a developer community and networking around open source projects.

What is a Version Control System (VCS) and its types

Version control is a mechanism that records alterations in files throughout time, allowing you to revisit specific versions in the future. It serves as a tool to reverse modifications, contrast various iterations, and identify the contributors behind specific alterations.

There are two main types of version control systems:

  1. Centralized VCS (CVCS):

    This model operates with a single, central repository responsible for storing all code versions. Developers are required to synchronize their work with this central repository to ensure cohesion and collaboration.

  2. Distributed VCS (DVCS):

    Git exemplifies a Distributed VCS. In this approach, each developer possesses a personal copy of the complete code repository, encompassing its entire history. This decentralization offers enhanced flexibility and robustness, as every developer holds a complete record of the project.

Git Vs GitHub

  • Git is the version control system itself, a command-line tool.

  • GitHub is a web-based platform that provides Git repository hosting and additional collaboration features, like issue tracking, pull requests, and project management tools.

  • Other similar tools to GitHub that use Git technology include GitLab, Bitbucket, and Azure DevOps.

Difference between Main and Master Branch

The main distinction between the "Main" and "Master" branches lies in GitHub's recent shift in terminology. To foster inclusivity and eliminate any connotations with "master/slave," GitHub now employs "main" instead of "master" as the default branch name. Importantly, this alteration is merely a naming convention and does not impact Git's core functionality.

Main / Master Branch explained with an example

Scenario: Imagine you're a writer working on a novel using Git for version control.

Master Branch: In this context, think of the "master" branch as the final, published version of your novel—a polished and complete manuscript that's ready for readers.

Day-to-Day Example:

  1. Writing Your Novel: You start by writing the first draft of your novel, starting from Chapter 1 and working your way to the end. This initial draft is stored in your "master" branch.

  2. Editing and Revisions: After completing your first draft, you realize there are improvements to be made. You create a new branch called "Editing" to work on revisions. In this branch, you can make changes like refining sentences, adding or removing paragraphs, and correcting typos.

  3. Beta Readers: You want feedback on your revised chapters, so you share the "Editing" branch with a group of beta readers. They provide suggestions and point out areas that need improvement.

  4. Incorporating Feedback: Based on the feedback from your beta readers, you make further revisions and edits in the "Editing" branch until you're satisfied with the quality of your manuscript.

  5. Final Manuscript: Once you're confident that your novel is in its best shape, you merge the changes from the "Editing" branch back into the "master" branch. Now, your "master" branch represents the final, polished manuscript ready for publication.

  6. Publishing: With the novel in its completed state in the "master" branch, you can now submit it to publishers, self-publish it, or share it with your readers. This "master" branch contains the authoritative and published version of your work.

In this scenario, the "master" branch is akin to the fully edited and finalized version of your novel—the one that you're proud to share with the world. Other branches, like the "Editing" branch, allow you to make changes and improvements without affecting the official manuscript until you're ready to incorporate those changes into the final version.

Hands-On with Git and GitHub

  1. Create a Repository:

    To start, we'll need a GitHub account. Once logged in

    • Click the '+' sign in the top right corner.

    • Select "New Repository."

    • Follow the prompts to create a new repository.

  2. Connect Local Repository to Remote Repository:

    Now, let's link our local code to our newly created GitHub repository:

    • Open local terminal.

    • Navigate to the project folder.

    • Use the following commands:

        git init
        git add .
        git commit -m "Initial commit"
        git branch -M main
        git remote add origin <repository_URL>
        git push -u origin main
  3. Make Changes, Commit, and Push:

    • Modify a file in the project.

    • Use these commands to commit and push the changes:

        git add .
        git commit -m "Your commit message"
        git push


In the world of software development, Git and GitHub are invaluable tools. Git empowers you with its version control capabilities, while GitHub provides an interactive platform for hosting and overseeing your code. As we journey further into the coding world, these tools will seamlessly integrate into our workflow.

Thank you for reading! Happy Learning.