Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

git - warning: refname 'HEAD' is ambiguous

I am new to Git and I seem to have one branch too many if I execute the following command:

warning: refname 'HEAD' is ambiguous.

I get the following output:

warning: refname 'HEAD' is ambiguous.
From github.com:dagda1/hornget
 * branch            master     -> FETCH_HEAD
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.

If I execute git branch -a

I get the following:

HEAD
* master
remotes/emmekappa/master
remotes/origin/HEAD -> origin/master
remotes/origin/master

I am confused by the remotes/origin/HEAD -> origin/master.

What is this and how can I get rid of the ambiguous branch.

I got to this stage by performing a merge where I think I added the ambiguous branch.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is that you have a branch called HEAD which is absolutely dangerous, since that's the symbolic name for whatever branch is the current branch.

Rename it:

git branch -m HEAD newbranch

then you can examine it and decide what to do (delete it, or save under a descriptive branch name)

(The origin/HEAD remote branch is not a problem)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...