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

拥有回忆 提交于 2019-11-28 15:38:53

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.

You can use git remote set-head origin -d to delete the origin/HEAD symbolic ref, or git remote set-head origin -a to query the remote and automatically set the origin/HEAD pointer to the remote's current branch.

The origin/HEAD reference is optional. It only acts as a syntactic shortcut: If it exists and points to origin/master, you can use specific simply origin where you would otherwise specify origin/master.

The git remote(1) man page describes this:

set-head

Sets or deletes the default branch (i.e. the target of the symbolic-ref refs/remotes//HEAD) for the named remote. Having a default branch for a remote is not required, but allows the name of the remote to be specified in lieu of a specific branch. For example, if the default branch for origin is set to master, then origin may be specified wherever you would normally specify origin/master.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!