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

·

4 min read

1 :- What is Git and why is it important?

Ans :- Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to track changes in the source code, enabling multiple developers to work together on non-linear development.

Git is a version control software that you need to install on your local system in order to use it. For an individual working on a project alone, Git proves to be excellent software. But what if you are working on a project with a large team? All will be working on the same project but each of you will be having a different version of the same project. Suppose you have made changes in the project directory on your machine and you want to send those changes to your collaborators. Also, you want the changes they make to appear directly in your machine’s project directory. When working on a project, being on the same page with your teammates is very crucial to avoid any type of conflict. So, how you will do that? Well, no worries Git takes care of all but the only condition here is, each of your team members must have Git installed on their systems.

Git also is known as a distributed version control system which means using Git you can push and pull yours as well as other's changes to other people’s machines:

Now, using Git you can work on the same copy as your team member. But the copy on which you will be working, won’t reflect any of the changes in the main directory unless and until you pull your collaborator’s changes and push back your own changes.

2 :- What is the difference Between Main Branch and Master Branch??

Ans :- There is no difference between main and master branch in git. Main or Master branch is a default branch when you create a repository. GitHub now uses main as it's default branch. while others still use master branch as a default branch.

Earlier, Microsoft GitHub also has master as their default branch, but some peoples at Microsoft think that the master name is kind of similar to slavery, which is offensive according to Microsoft. Hence they changed its name to main.

3 :- Can you explain the difference between Git and GitHub?

Ans :- Git vs Github

4 :- How do you create a new repository on GitHub?

Ans :- Go to your Github profile and then click on this .....

5 :- What is difference between local & remote repository? How to connect local to remote?

Ans :- The local repository is a Git repository that is stored on your computer.

The remote repository is a Git repository that is stored on some remote computer.
Git remote repositories are hosted on a server that is accessible for all team members.

A git remote command is used to make remote connections such as connecting a Git local repository with GitHub remote repository.

1 :- git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

2 :- git remote -v

3 :- git push origin master

## Task-1

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

Ans :-

## Task-2

- 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

Ans :-

The git init command transforms the current directory into a Git repository.

Here use git remote command to connect local repository to the GitHub repository.

git remote add origin <URL_from_GitHub_repository>

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

--Now, Push your local commits to the repository on GitHub

Now, refresh your github Devops repository.

Now, New branch added in this Devops repository.

**********Thank you for reading the article***********