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

后端 未结 7 1326
故里飘歌
故里飘歌 2020-11-28 01:16

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

7条回答
  •  -上瘾入骨i
    2020-11-28 01:54

    @robinst is correct.

    In git, you can select which branch is checked out by default (i.e. when you clone). By default, origin/HEAD will point at that.

    On GitHub, You can change this in the Admin settings for your GitHub repo. You can also do it from the command-line via

    git remote set-head origin trunk
    

    or delete it altogether via

    git remote set-head origin -d
    

    Example. Look at the 'Switch Branches' drop-down. trunk is checked, so origin/HEAD follows trunk.

提交回复
热议问题