Once you clone a git repository from github, you may need to figure out what other branches really exist on the remote repository so you can
pull them down and
merge them into your local branches. It is not a hard task if you are using GitHub Desktop. But much better to know if you interacting with command line.
For the sake of better understanding, lets look into an example of cloning a remote repository into your local machine.
To check the local branches in your repository
To list all existing Branches
Create a local tracking branch in order to work on it
Fetching all remote branches at once
Below I have explained the difference between
git pull &
Switching between branches
Creating a new tracking branch based on a remote branch
Deleting local branch
git pull vs
Git tries to automate your work for you. Since it is context sensitive, git will merge any pulled commits into the branch you are currently working in. pull automatically merges the commits without letting you review them first. You may run into frequent conflicts if you are mot managing your branches in a proper way.
Git gathers any commits from the particular branch that do not exist in your current branch & saves them in your local repository. But it doesn’t merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files.
In terms of source control, you’re
downstream when you copy (clone, checkout, etc) from a repository. Information flowed
downstream to you.
When you make changes, you usually want to send them back
upstream so they make it into that repository so that everyone pulling from the same source is working with all the same changes.