Deep Dive in Git & GitHub for DevOps Engineers

Deep Dive in Git & GitHub for DevOps Engineers

ยท

3 min read

Introduction

Greetings, fellow DevOps adventurers! As we delve into Day 9 of our 90-day journey, we're about to explore the captivating realm of Git and GitHub. These essential tools are the heartbeat of efficient collaboration and seamless teamwork in the DevOps landscape. In this blog, we'll answer burning questions, uncover their significance, and guide you through hands-on tasks. From understanding Git's pivotal role to deciphering the nuances of "Main" vs. "Master" branches, we're here to equip you with skills that elevate your DevOps prowess. Get ready to dive in and enrich your DevOps toolkit with Git and GitHub mastery! ๐Ÿš€๐Ÿ”

1. What is Git and why is it important?

Git is a version control system that helps track changes in files over time. It's crucial for collaborative software development, as it allows multiple people to work on the same project simultaneously without conflicts. Git helps you keep a history of changes, making it easy to review, revert, and collaborate effectively.

2. What is the difference between Main Branch and Master Branch?

The difference is in the terminology. Historically, the default and main development branch in Git was called "master." In recent times, the industry recognized that the term "master" could be perceived as insensitive. So, many projects have transitioned to using "main" as the default branch name to make the terminology more inclusive.

3. Can you explain the difference between Git and GitHub?

Git is a version control system that helps track changes in files locally. GitHub, on the other hand, is a web-based platform built around Git. It provides a centralized place to store Git repositories, enabling collaboration, code sharing, and issue tracking among developers, making it easier to work together on projects.

4. How do you create a new repository on GitHub?

To create a new repository on GitHub, log in to your account, click the '+' icon in the top right corner, and select "New Repository." Give it a name, description, and choose public or private. Click "Create Repository," and follow the instructions to add files, commit changes, and collaborate with others.

5. What is the difference between local & remote repositories? How to connect local to remote?

A local repository is on your computer and contains the actual files, while a remote repository is hosted on a server, like GitHub, and serves as a centralized place to collaborate. To connect them, first, create a remote repository on GitHub, then use the 'git remote add' command to link your local repository to the remote one. Finally, 'git push' uploads your local changes to the remote repository.

Tasks

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

    Step 1: Set your username

     git config --global user.name "Your Name"
    

    Replace "Your Name" with your actual name, and include the quotation marks.

    Step 2: Set your email address

     git config --global user.email "your@email.com"
    

    Replace "" with your actual email address, and include the quotation marks.

    By setting your username and email globally, you ensure that every commit you make on any Git repository will be associated with these credentials. This helps in identifying who contributed to the codebase.

  2. Create a repository named "Devops" on GitHub

  3. Connect your local repository to the repository on GitHub

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

  5. Push your local commits to the repository on GitHub

    Congratulations! You've embarked on your Git and GitHub journey. By completing these tasks and exercises, you've gained hands-on experience with version control and collaboration.

    In a world where collaboration is key, Git and GitHub provide the tools that empower developers to create, share, and innovate together. Start by mastering the basics, and you'll find yourself confidently contributing to the vast world of software development.

    Happy Learning!!!

    Reference

    To develop deeper into the world of DevOps I highly recommend following Shubham Londhe on TrainWithShubham and Bhupinder Rajput on Technical Guftgu.

ย