Why is there a `remotes/origin/HEAD -> origin/master` entry in my `git branch -l -a` output?

mistaecko picture mistaecko · Sep 27, 2012 · Viewed 34.1k times · Source

I don't understand the second line in the output to git branch -l -a: remotes/origin/HEAD -> origin/master.

git branch -l -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Is that a leftover from another operation? Should I clean it up? And how would I do that?

Usually I work with git on the cli, but on this local repository I experimented with TortoiseGit to find an easy git workflow for a friend.

Answer

VonC picture VonC · Sep 27, 2012

No, no need to clean up: it is the symbolic branch referenced by your remote repo.
When you clone your repo, you will be by default on the branch referenced by remotes/origin/HEAD.

See also:

Note: you need to use git branch --list (or git branch), not git branch -l.