[git] In Git, what is the difference between origin/master vs origin master?

I know, origin is a term for the remote repository and master is the branch there.

I am purposely omitting the "context" here and I am hoping that the answer should not depend upon the context. So in git command lines, what is the difference between origin/master and origin master. Is there a non-ambiguous way to understand when to use origin/master and when I should use origin master?

This question is related to git

The answer is


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)
  • master - (actual branch)
  • <Your_local_branch> (actual branch)
  • <Your_local_branch4> (actual branch)
  • <Your_local_branch4> (actual branch)

Example (in local branch master):

git fetch # get current state of remote repository
git merge origin/master # merge state of remote master branch into local branch
git push origin master # push local branch master to remote branch master

I suggest merging develop and master with that command

git checkout master

git merge --commit --no-ff --no-edit develop

For more information, check https://git-scm.com/docs/git-merge


origin is a name for remote git url. There can be many more remotes example below.

bangalore => bangalore.example.com:project.git

boston => boston.example.com:project.git

as far as origin/master (example bangalore/master) goes, it is pointer to "master" commit on bangalore site . You see it in your clone.

It is possible that remote bangalore has advanced since you have done "fetch" or "pull"


origin/master is the remote master branch

Usually after doing a git fetch origin to bring all the changes from the server, you would do a git rebase origin/master, to rebase your changes and move the branch to the latest index. Here, origin/master is referring to the remote branch, because you are basically telling GIT to rebase the origin/master branch onto the current branch.

You would use origin master when pushing, for example. git push origin master is simply telling GIT to push to the remote repository the local master branch.


Given the fact that you can switch to origin/master (though in detached state) while having your network cable unplugged, it must be a local representation of the master branch at origin.