Git branch named origin/HEAD -> origin/master

Solution 1:

HEAD usually points to the currently checked out branch. In hosted (bare) repositories, it designates the default branch, i.e. the branch that is checked out when you clone the repository. So, origin/HEAD tells you the default branch of origin.

I don't know why it's not present in your repository on the Ubuntu system. Perhaps you originally pushed your code from that repository (when origin was empty and thus didn't have a HEAD yet) and never updated it.

Having something like origin/HEAD is not terribly important in practice, anyway. If you want, you can use git remote set-head origin -a to have origin/HEAD created/updated

To answer your other question: if you run git pull without arguments, it actually fetches everything from the remote (git fetch is run without arguments, too, so it just gets everything). Everything doesn't get merged, though. Only the remote-tracking branches (the stuff in git branch -r) are updated.

Solution 2:

As far as I know, HEAD is not a branch, but rather a pointer to a node of the history tree (i.e. a commit). The files which are residing in you particular working copy have the state described by HEAD.

Usually HEAD points to the most recent commit in a branch, so you have the most recent files in the working copy. Using git reset HEAD^ you can shift the pointer to previous commit (i.e. undoing the last commit in your local copy).

Now, every git repo has a HEAD, check this with git show HEAD. Accordingly, origin/HEAD is HEAD of your origin remote.

Now, I've found a good question describing HEAD: What is HEAD in Git?

Solution 3:

It is just a pointer to master, a symbolic link if you wish. You can safely delete it by doing the following in a terminal (or git bash/cygwin for windows users):

  1. navigate to your repository
  2. execute: git remote set-head origin -d

now it should be gone:

$ git branch -r
origin/master