Day 9 - Deep Dive in Git & GitHub for DevOps Engineers

Day 9 - Deep Dive in Git & GitHub for DevOps Engineers

The world of DevOps is an exciting, ever-evolving space where collaboration, version control, and seamless project management reign supreme. One of the cornerstones of DevOps is Git, a version control system that's more than just a tool—it's a way of life for developers and engineers. In this blog, we'll unravel the mysteries of Git, explore the differences between the "Main" and "Master" branches, shed light on Git vs. GitHub, and guide you through the steps to create and connect repositories. So, grab your virtual hard hat and let's embark on this DevOps adventure!

What is Git, and Why is it Important?

Git is a distributed version control system that revolutionized the way developers track changes to files and collaborate on projects. But why is Git so important?

In the realm of software development and DevOps, Git plays a vital role in:


  • Version Control: Git tracks every change made to a file, providing a meticulous history that allows developers to revert to earlier versions, compare changes, and understand who made what change.
  • Collaboration: Git makes collaboration a breeze. Multiple team members can work on a project simultaneously, and Git ensures that their changes are integrated seamlessly.
  • Data Integrity: With Git, data integrity is paramount. All changes are tracked, making it easier to identify issues and roll back if necessary.


Main Branch vs. Master Branch

Now, let's clarify a common source of confusion in Git—the difference between the "Main" and "Master" branches. Historically, "Master" was the default branch name in Git repositories, but in recent years, the industry has been moving towards more inclusive and neutral terms. The term "Main" is now often used instead of "Master."

It's essential to note that these names are interchangeable, and the choice between "Main" or "Master" is more about inclusivity and diversity. However, both branches serve the same purpose—they represent the primary branch of your repository.

Git vs. GitHub: Unveiling the Distinction

Git and GitHub are often mentioned in the same breath, but they serve different purposes:


  • Git is a distributed version control system, a tool that you install on your local machine. It tracks changes to files, allowing you to manage projects, collaborate with others, and ensure data integrity.
  • GitHub, on the other hand, is a web-based platform that provides hosting for version control using Git. It's a platform for hosting repositories, collaborating on projects, and sharing code with a global community.


In essence, Git is the engine under the hood, while GitHub is the virtual garage where you park your code.

Creating a New Repository on GitHub

Creating a new repository on GitHub is a straightforward process. Follow these steps:

Task 1: Set your username and email address for commits.

git config --global user.name "Your Name" 
git config --global user.email "[email protected]"        

Task 2: Create a repository on GitHub.


  1. Log in to your GitHub account.
  2. Click on the "+" sign in the upper right corner and choose "New Repository."
  3. Fill in the repository name, description, and other settings.
  4. Click "Create repository."


Task 3: Connect your local repository to the GitHub repository.


  1. In your local project directory, use the following commands:


git remote add origin your-repo-url.git 
git branch -M main 
git push -u origin main        

Task 4: Create a new file in your GitHub repository.


  1. Create a file in your local project directory.
  2. Add content to the file.
  3. Commit your changes using Git.
  4. Push the changes to your GitHub repository using the git push command.


That's it! Your local and remote repositories are now connected, and you've successfully added a file to your GitHub repository.

Wrapping Up

DevOps is all about collaboration, version control, and efficient project management. Git, with its impeccable version tracking and collaboration capabilities, is a cornerstone of the DevOps universe. By understanding Git, GitHub, and their nuances, you'll be well-equipped to navigate this exciting journey.

So, whether you choose "Main" or "Master," embrace the power of Git, and let your DevOps adventure begin.

Koenraad Block

Founder @ Bridge2IT +32 471 26 11 22 | Business Analyst @ Carrefour Finance

10 个月

This is informative, thanks for sharing!

要查看或添加评论,请登录

Kartik Bhatt的更多文章

社区洞察

其他会员也浏览了