Deep Dive in Git and GitHub for DevOps Engineers.

Deep Dive in Git and GitHub for DevOps Engineers.

·

3 min read

Q1. What is Git and why is it important?

answer :- Git is a distributed version control system (DVCS) used for tracking changes in source code during software development.

here are some key reason why git is important in the world of software development:

  1. Version Control

  2. Distributed

  3. Branching

  4. Merging

  5. Committing

  6. History and Log

  7. Conflict Resolution

  8. Staging Area

  9. Open Source

Q2. What is the Difference Between main Branch and Master Branch?

answer :- The main difference between the "master" branch and the "main" branch (or whatever other name is used for the default branch) is essentially the name itself. These branches serve the same purpose: they are typically the default branch where the latest stable version of the code is found.

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

answer :- Git is a version control system that manages and keeps track of your code. GitHub, on the other hand, is a service that let you host, share, and manage your code files on the internet. GitHub uses Git underneath, and lets you manage your Git repositories or folders easily on its platform.

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

  1. Sign in to your GitHub account: If you don't have a GitHub account, you'll need to create one.

  2. Once you're logged in, click on the "+" sign in the top right corner of the GitHub website

  3. In the dropdown menu, select "New repository."

  4. You will be taken to the "Create a new repository" page. Here, you'll need to provide the following information for your new repository:

a. Repository name: Choose a name for your repository. This should be unique within your GitHub account.

b. Description (optional): Provide a brief description of your repository to help others understand its purpose.

c. Visibility: You can choose to make the repository public (visible to everyone) or private (visible only to those with access).

d. Initialize this repository with a README: If you want to create a README file for your repository, check this option. A README file is helpful for providing information about your project.

5 You can also choose to add a .gitignore file (specifies which files or directories should be ignored by Git) and a license file (specifies the licensing terms for your project).

6 Once you've filled in the required information and made any additional selections, click the "Create repository" button.

Your new GitHub repository will be created with the specified settings, and you'll be redirected to the repository's page. From there, you can start adding files, committing changes, and collaborating with others on your project.

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

answer :- A local repository is on the local machine - much like the keyboard attached to a computer is local to that computer.

Likewise, a remote repository is a repository on some other machine which is remote to a given local machine.

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at.

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

• git config --global user.name "asadkhan"

• git config --global user.email "useremail"

2 Connect your local repository to the repository on GitHub.

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

4 Push your local commits to the repository on GitHub