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 a
You're right that pushing to dedicated remote repos work much better when they are 'bare', that is, when they don't have working directories. Git's architecture is designed for updating by patches or pull
(fetch
), which makes sense in a distributed VCS. As the docs say somewhere, pushing to a branch which is currently checked out can result in "unexpected results".
The HEAD is part of the requirements for a valid repository. Git Repository Layout says, in part:
HEAD
A symref (see glossary) to the refs/heads/ namespace describing the currently active
branch. It does not mean much if the repository is not associated with any working tree
(i.e. a bare repository), but a valid git repository must have the HEAD file; some
porcelains may use it to guess the designated "default" branch of the repository
(usually master). It is legal if the named branch name does not (yet) exist.
So you're going to see HEAD as part of the branch list, even if "it does not mean much..."