Git warning: refname 'xxx' is ambiguous

浪子不回头ぞ 提交于 2019-12-03 05:50:53

From your original question it looks like you have a tag and a branch named hotfix-1. Of course, their actual names are refs/tags/hotfix-1 and refs/heads/hotfix-1 respectively, but Git allows you to use the shorthand, which in this case is ambiguous since Git allows you to use any committish in the git merge statement. In fact, when I tested this scenario, Git merged the tag, and not the branch.

When looking at your git show-ref --heads --tags output it is unclear, though, since there only a tag named hotfix-1.0.1, and no branch with the same name. It looks like you may have changed things subsequently.

Here's an example where what Joseph's assumption about what happened actually happened to us.

git merge BranchyBranch_r2.1 warning: refname 'BranchyBranch_r2.1' is ambiguous.

There actually is both a tag and a branch of the same name (BranchyBranch_r2.1), and on top of that, someone tried to alleviate the problem by aliasing the tag that duplicated the branch.

git show-ref --heads --tags ac729d902578378557f9f20dbd415c5748a23230 refs/heads/BranchyBranch_r2.1 9f3d242e03837fd33f8355005e9edbee89367bef refs/heads/develop 5995987876e6a2315544bd774b546ed561f78a53 refs/heads/master df26c94be018268e2897807c0750b5c66150750b refs/tags/BranchyBranch_r2.1 df26c94be018268e2897807c0750b5c66150750b refs/tags/BranchyBranch_r2.1Tag

If you refer to the branch by its fully qualified name, then you can proceed.

git merge refs/heads/BranchyBranch_r2.1

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