Day 8 : Deep Dive into Git & GitHub

·

2 min read

1.What is the difference Between Main Branch and Master Branch?

There is no difference. In the past ‘master’ was the typical default branch in a git repo. This word is considered inherently offensive by some, and so it was replaced with ‘main’ more recently.

After Microsoft acquired GitHub, following their convention, "main" was kept as the default branch for a GitHub repository.

2.What is the difference between local & remote repository?

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 or server.

The remote repository is usually used by teams as a central repository. Everyone pushes changes from his local repository to the central repository and pulls updates to his local repository.

When you are finished with doing changes to your workspace, you can add them to the staging area and from there you can commit the changes to your local repository. This can be done even when you are disconnected from the internet and nobody else can see the changes in your local repository.

Once you decide it's a good time to share the changes, you push the changes from your local repository to the remote repository. This action copies the changes from .git folder on your local computer to .git folder on the remote computer. After this, your changes are visible to people who have access to the remote repository.

They can pull your changes from the remote repository to their local repository and then integrate the changes into their workspaces.

Similarly, you can pull other's changes from the remote repository to your local repository and then integrate the changes into your workspace.

3.How to connect local to remote repository?

git remote add <name> <url>

add: to add a new URL to the repository.

name: a name that you will use instead of the URL of the repository.

url: the URL of the repository.

If this post was helpful, please follow and click the 💚 button below to show your support.

_ Thank you for reading!

_Sudipa