GitHub contains fixed commands to perform various tasks and actions.
To include a project from GitHub to a local repository, we must write the git pull
command.
pull
a remote branch
?We pull
a remote branch as it downloads new changes from branchname
onto the remote branch named origin
and integrates them into our local branch.
branches
in git
Branches are the different realities of a master branch. We can create several branches and merge them with our primary working branch, called the master branch.
We can use git pull
as an alternative to git fetch
and git merge
in the same command.
Git does not merge the changes from the branches into our current master. But, suppose we’ve checked out the branch master,
and now we want to merge in the remote branch branchname.
To integrate this command into our project, we write it in the following way:
git pull origin branchname
The origin
is the remote branch which is the primary working directory of a project. All other branches merge into this branch.
branchname
is just another branch, or a copy of the original branch, where developers code independently. And after the final review from testers, these local branches merge with the master branch origin.
When we write the above command, git is applying two commands:
git fetch origin branchname && git merge branchname
git pull origin branchname
commandThe git pull origin branchname
generally tells the git
to pull
/fetch
(projects and data) from the remote repo named origin
to our branchname
, illustrated in the figure below.
Free Resources