Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between git pull origin master & git pull origin/master

What is the difference between git pull origin master and git pull origin/master ?

like image 428
Rachel Avatar asked May 21 '10 16:05

Rachel


People also ask

What is the difference between git pull and git pull origin master?

Remember, a pull is a fetch and a merge. git pull origin master fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.

What does git pull origin master mean?

'git pull origin master' will fetch and update only a specific branch called master and origin in the remote repository. Often, the default branch in Git is a master branch, and it keeps updating frequently. A user can use any branch name to pull that branch from the remote.

What is git origin vs master?

Origin and master are just two default names used commonly by Git. Origin is the remote repository from where we cloned our local repository and we will be pushing and pulling changes to it. Master is the default name given to the first branch present in a Git repository when it is initialized.

Is Origin and master the same?

origin/master is an entity (since it is not a physical branch) representing the state of the master branch on the remote origin . origin master is the branch master on the remote origin . So we have these: origin/master ( A representation or a pointer to the remote branch)


1 Answers

git pull origin master will pull changes from the origin remote, master branch and merge them to the local checked-out branch.

git pull origin/master will pull changes from the locally stored branch origin/master and merge that to the local checked-out branch. The origin/master branch is essentially a "cached copy" of what was last pulled from origin, which is why it's called a remote branch in git parlance. This might be somewhat confusing.

You can see what branches are available with git branch and git branch -r to see the "remote branches".

like image 86
Jakob Borg Avatar answered Sep 30 '22 22:09

Jakob Borg