1

Here is the branch dropdown on Github.com for my repository.

$ git branch -r
origin/HEAD -> origin/master
origin/dev
origin/master
michas
  • 25,361
  • 15
  • 76
  • 121
clinton
  • 132
  • 1
  • 8
  • http://stackoverflow.com/questions/22363543/understanding-git-branch-all/22363716#22363716 – michas Mar 13 '14 at 18:49
  • possible duplicate of [What is git HEAD, exactly?](http://stackoverflow.com/questions/2304087/what-is-git-head-exactly) – Hauleth Mar 13 '14 at 18:55
  • Not a duplicate of that question. This one is about `origin/HEAD` which is different from `HEAD`. – michas Mar 13 '14 at 21:28
  • Yes but it's not a branch, so should not show up like that in the dropdown on Github.com. My other remote repositories don't. – clinton Mar 13 '14 at 22:24

2 Answers2

1

HEAD is not a branch, but it is a reference. References in git are basically pointers to commits with a name attached. In fact, branches and tags are references but there are also other types.

Now, HEAD is a special reference that points to the currently checked out commit. In the case of a remote repository, it's the default commit that gets checked out if you clone the repo. This points to a branch most of the time. The common default is the master branch which is the case here too.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
1

HEAD is not really a branch but a pointer (aka symref) to a branch (or commit).

Your local HEAD points to the currently checked out branch. The remote origin/HEAD points to the main branch, i.e. the branch checked out after a clone.

michas
  • 25,361
  • 15
  • 76
  • 121
  • Yes but it's not a branch, so should not show up like that in the dropdown on Github.com. My other remote repositories don't. – clinton Mar 13 '14 at 22:23