Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: refname 'HEAD' is ambiguous

Tags:

git

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)


Also, this will delete the branch, if you just don't want it.

git branch -d HEAD

Use a capital -D to force the deletion:

git branch -D HEAD

If you have created a tag named HEAD using...

git tag HEAD

...you can just delete that tag using:

git tag -d HEAD

See this case: kerneltrap.org/git-tag HEAD


This means that you have a branch named "head". I had the same issue, I solved by doing the following command.

git branch -d head

Check references available in your git repository. You will observe two HEAD in your repository. This makes your branch with refname HEAD ambiguous.

git show-ref

Solution:

  • Rename the branch

    git branch -m HEAD <new_branch_name>
    

    OR

  • Delete the branch

    git branch -d HEAD