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

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

Table of contents

  1. What is Git and why is it important?

    Git is a version control system used for tracking changes in computer files. It is generally used for source code management in software development.

    • Git is used to track changes in the source code

    • The distributed version control tool is used for source code management

    • It allows multiple developers to work together

    • It supports non-linear development through its thousands of parallel branches

Features of Git :

  • Tracks history

  • Free and open source

  • Supports non-linear development

  • Creates backups

  • Scalable

  • Supports collaboration

  • Branching is easier

  • Distributed development

working-directory

  1. What is the difference Between Main Branch and Master Branch??

    Branch in Git:

    A branch in Git is used to keep your changes until they are ready. You can do your work on a branch while the main branch (master) remains stable. After you are done with your work, you can merge it with the main branch.

    They are conceptually the same thing. The convention just changed: previously the primary branch was called master and for a newer repository that defaults to main.

  2. Can you explain the difference between Git and GitHub:

    Git

    GitHub

    Git is software.

    It is a service.

    Linux maintains Git. 

    Microsoft maintains GitHub. 

    It is a command-line tool.

    It is a graphical user interface.

    You can install it locally on the system. 

    It is hosted on the web. It is exclusively cloud-based.

    It is a VCS to manage source code history. 

    It is a hosting service for Git repositories.

    It focuses on code sharing and version control.

    It focuses on centralized source code hosting.

    It lacks a user management feature.  

    It has a built-in user management feature.

    Git was launched in 2005. 

    GitHub was released in 2008.

    Git has minimum external tool configuration.

    It has an active marketplace for tool integration.

    It is open-source licensed.

    It has a free tier and a pay-for-use tier.

    Its desktop interface is named Git Gui.

    Its desktop interface is named GitHub Desktop.

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

    1. Create a GitHub account and log in to it. You will find a new repository icon on the right top of the page.

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

    Local repositories reside on the computers of team members. In contrast, remote repositories are hosted on a server that is accessible to all team members - most likely on the internet or a local network.

    1. Create a new remote repository on a hosting service like GitHub, GitLab, or Bitbucket. Now we can copy the repo URL

Now clone the repository by using this command.

Now we need to add that file to the staging area and check the status:

Then need to commit that file:

$ git commit -m "message"

you can set the user name in the config file.

$git config --global user.name "Username"

Push the changes back to the repository on GitHub:

$ git push <remote> <branch name>

Task:

  • Create a repository named "Devops" on GitHub

  • Connect your local repository to the repository on GitHub.

  • 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!!!!!!

      Happy Learning!!!!!!