Deep Dive in Git & Github
Few QnA
1- What is Git and why is it important?
Git is a distributed version control system (DVCS) that is widely used in software development for tracking changes in source code during the development process. It was created by Linus Torvalds in 2005 and has since become the standard version control system for managing and tracking changes in software projects.
Importance:
Git is important in software development because it provides a robust and efficient way to manage and track changes in source code, facilitates collaboration among developers, and offers features like branching and merging that enhance the overall development process.
DID YOU KNOW!
Linus Torvalds is the same person who created LINUX.
2-What is difference Between Main Branch and Master Branch?
The terms “main” and “master” have historically been used interchangeably in version control systems like Git to refer to the primary branch of a repository. However, there has been a push in recent years to move away from using the term “master” due to its potentially negative and exclusionary connotations.
3-Can you explain the difference between Git and GitHub?
Git is a distributed version control system (DVCS) that allows developers to track changes in their source code during software development.
GitHub is a web-based platform that provides hosting for software development projects using Git.
4-What is difference between local & remote repository? How to connect local to remote?
Repository present in the local system is Local repo and the one which is present in Github is remote repo.
Get Deepanshu Kansal’s stories in your inbox
Join Medium for free to get updates from this writer.
Using git remote command local to remote connection is possible
TASKS
1-Set your user name and email address, which will be associated with your commits.
Set your username:
git config --global user.name "FIRST_NAME LAST_NAME"
Set your email address:
git config --global user.email "MY_NAME@example.com"2-Configuring Remote to Local
git remote set-url origin <GITHUB_URL>Here is a catch in this ,suppose Github URL is:
https://github.com/DeepanshuKansal/test_repo.gitNow everytime while pushing to Github we have to specify username and password to overcome this we can pass a token in the URL itself so that self authentication can happen.
Token can be c reated by going to
Settings->Developer Settings -> Personal Access Tokens -> Token(Classic)
And Generate a new token.
NOTE1: Remote to give Repo read and write to token
Note2:Token once created should be saved as it cant be retrieved.
Now , we can use below command to add the token generated:
git remote set-url origin https://TOKEN@github.com/DeepanshuKansal/test_repo.gitHere replace TOKEN with generated token and URL of GIT with your Repo URL.
Thats all for this blog Lets meet in next…







