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

What is Git and why is it important?

Git Tutorial - javatpoint

Git is a version control system that helps developers track changes to their code over time, collaborate with others, and manage multiple versions of a project. It's important because it provides a structured approach to software development, making it easier to manage and collaborate on code.

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

5 steps to change GitHub default branch from master to main | R-bloggers

In practical terms, the difference between the "main" and the "master" branch is largely a matter of convention and preference. Some developers and organizations prefer to use "main" to refer to the default branch, while others continue to use "master".

Regardless of which term is used, the default branch is typically where the latest stable version of the codebase is stored, and other branches are created off of it for experimental features or bug fixes.

Can you explain the difference between Git and GitHub?

Git vs GitHub - javatpoint

Git and GitHub are related but different tools. Git is a version control system that allows developers to track changes to their code over time and collaborate with others on the same codebase. It is a command-line tool that can be used locally on a developer's computer.

On the other hand, GitHub is a web-based hosting service for Git repositories. It provides a platform for developers to store their Git repositories in the cloud, collaborate with others, and share their code with the wider community.

How do you create a new repository on GitHub?

To create a new repository on GitHub, follow these steps:

  1. Log in to your GitHub account.

  2. Click on the "+" icon in the top right corner of the page.

  3. Select "New repository" from the dropdown menu.

  4. Enter a name for your repository.

  5. Add a description if you like (optional).

  6. Choose whether you want the repository to be public or private.

  7. Select the checkbox to "Initialize this repository with a README" (optional).

  8. Choose a license if you like (optional).

  9. Click "Create repository".

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

Basic Git Commands With Examples [+Cheat Sheet]

A local repository is a copy of a Git repository that is stored on your own computer, while a remote repository is a copy that is stored on a remote server or hosting service, such as GitHub.

TASKS:

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

git config --global user.name "<name>"
      git config --global user.email "<email id>"
      To check 
      git config --list

Create a repository named "Devops" on GitHub:

Connect your local repository to the repository on GitHub.

At first, go to your Repository and copy the URL:

After initializing git with git init command:

git init
git remote add origin <URL>

Other than this task could be:

Create a new file in ShubhamJangle8/sample/file2 & add some content to it:

At First Clone this Repo into your local machine:

git clone <URL>

Create a file in Devops/Git:

Commit it :

git commit -m "<your message"

Push your local commits to the repository on GitHub:

git push -u origin <present branch>

you can check it : git branch

You can check it on your Github Account:


\=======================THANKYOU==========================

Shubham Jangale :)