Why is "origin/HEAD" shown when running "git branch -r"?

Posted by Ben Hamill on Stack Overflow See other posts from Stack Overflow or by Ben Hamill
Published on 2008-12-09T21:36:29Z Indexed on 2010/05/21 15:10 UTC
Read the original article Hit count: 232

Filed under:
|
|

When you run git branch -r why the blazes does it list origin/HEAD? For example, there's a remote repo on GitHub, say, with two branches: master and awesome-feature. If I do git clone to grab it and then go into my new directory and list the branches, I see this:

$ git branch -r
origin/HEAD
origin/master
origin/awesome-feature

Or whatever order it would be in (alpha? I'm faking this example to keep the identity of an innocent repo secret). So what's the HEAD business? Is it what the last person to push had their HEAD pointed at when they pushed? Won't that always be whatever it was they pushed? HEADs move around... why do I care what someone's HEAD pointed at on another machine?

I'm just getting a handle on remote tracking and such, so this is one lingering confusion. Thanks!

EDIT: I was under the impression that dedicated remote repos (like GitHub where no one will ssh in and work on that code, but only pull or push, etc) didn't and shouldn't have a HEAD because there was, basically, no working copy. Not so?

© Stack Overflow or respective owner

Related posts about git

Related posts about version-control