search

Home  >  Q&A  >  body text

git warning: refname 'HEAD' is ambiguous. What is the problem?

git status
git warning: refname 'HEAD' is ambiguous
git warning: refname 'HEAD' is ambiguous
On branch develop
Your branch is up-to-date with 'origin/develop'
nothing to commit, working tree clean

The ref information is as follows

git show-ref
...... refs/heads/HEAD
...... refs/heads/develop
...... refs/heads/master
...... refs/remotes/origin/HEAD
...... refs/remotes/origin/develop
...... refs/remotes/origin/master
...... refs/tags/v1.0
...... refs/tags/v1.1

How to solve it?

習慣沉默習慣沉默2792 days ago1459

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:43:09

    This problem is because you have a branch called HEAD 的分支造成的,这个名字你可以看作是一个保留字,它用于标示哪个分支是 当前分支 ,而不应该直接拿来做分支的名字(但是 remote 的 HEAD 分支是 OK 的,比如 origin/HEAD,经常有人把这个 checkout 下来,结果就变成了本地的 HEAD, which is where this problem comes from).

    The solution is very simple. Just delete or rename the branch. For example, delete:

    git branch -D HEAD

    In addition, someone also created a tag using HEAD, which will also cause the same problem, p.s.

    reply
    0
  • Cancelreply