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?
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.