Day 9: Deep Dive in Git & GitHub for DevOps Engineers.

90DaysOfDevOps

·

3 min read

Day 9: Deep Dive in Git & GitHub for DevOps Engineers.

What is Git and why is it important?

Git is like a tool where you can keep track of your code and the change in files. Imagine you are working on a project with your colleagues, and all of you are editing the same file simultaneously.

Git is important because it provides a way for multiple people to collaborate on a project and keep track of the changes made to the code over time.

What is the difference Between Main Branch and Master Branch?

In essence, the difference between "main" and "master" is mainly in their names and the connotations they carry. Functionally, they both refer to the primary development branch in a Git repository

Master Branch: Historically, "master" was the default branch name in Git. It was used as the primary development branch where the main codebase resided.

Main Branch: The "main" branch serves the same purpose as the "master" branch – it's the default branch where the primary development work occurs. It's the starting point for new development, and other branches are often created from it.

Can you explain the difference between Git and GitHub?

Git is a distributed version control system (VCS) that is widely used for tracking changes in source code during software development.

GitHub is one of the most popular and widely used platforms for hosting and managing code repositories.

How do you create a new repository on GitHub?

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

local: a local repository is a copy of a project that is stored on your computer. You can make changes to the code in your local repository.

remote: a remote repository, on the other hand, is a version of your project that is stored on a server and is accessible from anywhere with an internet connection.

To connect a local repository to a remote repository, you need to use the “git remote” command

git remote add origin <remote_repository_url>

Task-1:

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

  1. Set Your User Name:

    • Type the following command to set your user name:

          git config --global user.name "Your Name"
      
    • Replace "Your Name" with your actual name. For example, if your name is John Doe, the command will be:

          git config --global user.name "John Doe"
      
  2. Set Your Email Address:

    • Type the following command to set your email address:

          git config --global user.email "youremail@example.com"
      
    • Replace "" with your actual email address. For example:

          git config --global user.email "johndoe@example.com"
      

Task-2:

Create a repository named "Devops" on GitHub

Connect your local repository to the repository on GitHub.

To connect the remote repository in to your your local computer. You have to use the 'git clone' command.

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

Push your local commits to the repository on GitHub

Thank you for reading!