What is Git and why is it important?
Ans. Git is an open-source DevOps tool with distributed version control system. Git is very fast and secure as compared to other version control systems. It also helps in collaboration of code. The unique feature git exhibits is to roll back to the previous versions. Git is authored by Linus Torvalds in 2005 for the development of Linux Kernel.
What is the difference between Main Branch and Master Branch?
Ans. There is no difference between both main and master branches as they work the same. Earlier, Microsoft GitHub was using master as the default branch name, but some people in Microsoft thought that the word “master” is offensive as it reminds of the master/slave system. Hence they changed the name “master” to “main” very recently.
Can you explain the difference between Git and GitHub?
How do you create a new repository on GitHub?
Ans. Once logged into the GitHub dashboard, on the right-hand side, we have an option to create a "new repository" by giving the required details.
See below screens to have a clear picture:
What is the difference between local & remote repository? How to connect local to remote?
Ans. Local repository is a storage area in ur computer where you manage and track changes in files. It is like a folder that holds your project files and keeps a history of the changes made to those files.
Remote Repository is hosted on a server like GitHub, Bitbucket, etc. It provides a central place where multiple people can contribute, track changes, and work together.
By using the below command we can connect local to remote:
git remote add origin
https://github.com/beulahibaseit/TWS-batch_four.git
eg:
Task-1:
Set your user name and email address, which will be associated with your commits.
Task-2:
Create a repository named "Devops" on GitHub
Give permission for the file Day_02.txt file as follows:
Connect your local repository to the repository on GitHub.
Push your local commits to the repository on GitHub.
Check for the logs in git log.
Go to the GitHub and check for the changes in the remote repository.
vi Day_02.txt
Check the git status as below:
Push to the remote repo as follows:
Go to the GitHub and check for the new changes in the remote repository.
Thank you for your valuable time
Hope you have enjoyed reading the blog, if so please like and subscribe.
You are most welcome to give any feedback or suggestions.