Table of contents
- What is Git, and why is it important?
- What is the difference Between the Main Branch and the Master Branch??
- Can you explain the difference between Git and GitHub?
- How do you create a new repository on GitHub?
- What is the difference between local & remote repositories? How do you connect local to remote?
- How do you connect local to remote?
I will write the notes today on the below topic, in my own words.
What is Git and why is it important?
What is the difference Between the Main Branch and the Master Branch??
Can you explain the difference between Git and GitHub?
How do you create a new repository on GitHub?
What is the difference between local & remote repositories? How do you connect local to remote?
What is Git, and why is it important?
GIT, A Global Information Tracker the name itself explains it. You are tracking the information. Imagine, your client requires a new function in his software and you have a team of 5 members who will be working on that request, Each of you is working on the different features and wants to save the progress of your code and program. Every individual may maintain their progress, but what if it gets lost, the deadline is near, and we have to deliver the requirements in time?
Here's how Git plays a crucial role in this scenario:
GIT allows developers to track changes to the codebase or to the project, each developer can work on their project in a different branch so the main codebase will remain untouched, suppose one developer is working on adding a new feature to the product, while another one is working to fix the bug, all of them can work individually and can save their progress in the code.
GIT also allows or provides a very cool feature of Reversing/undoing. If developers make a bad commit, Git provides flexibility to developers to Revert or undo the commit.
If new code does not work well, git gives the flexibility to switch to the previous version at any time. So basically, git provides a platform not only to the developers but to the operational people to work effectively, collaborate, and version control.
What is the difference Between the Main Branch and the Master Branch??
Both are the default branches.
Git - The default branch is called as "master"
When creating a new repository in Git, "master" has always been the default branch name.
GitHub - The default branch is called as "main"
GitHub declared at the end of 2020 that they were switching the default branch name from "master" to "main". With this update, we hope to remove any potentially harmful language from GitHub and make it more inclusive.
Can you explain the difference between Git and GitHub?
Git is a version control system (VCS) that manages source code locally on developers' machines, while GitHub is a web-based platform and hosting service for Git repositories.
Git provides the core version control functionality, such as tracking changes, branching, and merging, whereas GitHub offers additional collaboration and project management features built around Git repositories.
While Git is used locally, GitHub is used online to host remote repositories, facilitate collaboration, and provide social coding features.
Git is a tool, whereas GitHub is a service and platform built around Git. While GitHub is the most popular platform for hosting Git repositories, there are alternative platforms like GitLab and Bitbucket that offer similar functionality.
How do you create a new repository on GitHub?
Login to you GitHub account.
On the home page, with the repository tab and click on new.
Fill in the details and click on Create Repository.
What is the difference between local & remote repositories? How do you connect local to remote?
A local repository is a repository you created on your local machine using Git, whereas a remote repository is a repository that we create on GitHub.
How do you connect local to remote?
Clone the remote repo on your local machine.
git clone "path"
To connect the local repository to the remote one, we need to use an access token which we can generate on GitHub under the developers' settings tab.
GitHub >> Click on the profile >> Setting >> Developers Setting >> Personal access token >> Token classic >> Generate new token,
Once we get the access token we need to edit the URL we gonna use to connect to this remote repo, with the below command we can do that.
git remote set-url origin https://"access token"github.com/bcomtodevops/testrepository.git
Once you edit the URL with a personal access token, you have connected your local repo to the remote repo. You can pull and push the changes now.
Let's add a new file and push it to the remote.
Thank you for joining me on this journey into DevOps! Your curiosity is the driving force behind this exploration. If you found value in these insights, I'm thrilled! Keep the DevOps flame alive, and stay tuned for more exciting adventures in the world of technology. Happy Learning! 🚀✨"
"Closing the gap between us—let's connect and make our virtual bond stronger on social media!
Click on -Umesh Salunkhe