Git警告:refname'xxx'不明确 [英] Git warning: refname 'xxx' is ambiguous
问题描述
我有两个分支'master'和'develop',我创建了一个来自主'hotfix-1'的新分支,然后我将'hotfix-1'合并回到master;
git checkout master
git merge --no-ff hotfix-1
为此创建了一个标记;
git tag -a hotfix-1 -m
然后我切换回从master开始分支并合并'hotfix-1' with;
git checkout develop
git merge --no-ff hotfix-1
$合并'hotfix-1'开发后,我得到警告:refname'hotfix-1'含糊不清 讯息和它成功合并了我的更改以开发。我应该担心什么吗?
编辑
git show-ref --heads --tags
d97bfc563749918799d4659c43f7bffd29cf4d60 refs / heads / develop
594ea85c94f8321d372779ed3dbd5df07bdb059b参/头/主
ffc897f8ab19510d5ff4c67969d0f0cb97d1c4f3参/标签/β-类1.0
490a8c80ecec70fd2268aa0c2ad7a9beb6bf491c参/标签/β-类1.1
644adadb43744ad1d2e0f13fc37abb6906520f8f参/标签/修复程序-1.0.1
4c49e8d9ddc8d601ed794f307e1c29acfc84b31b参/tags/release-1.0
解决方案看起来您有一个标签和一个名为 hotfix-1
的分支。当然,它们的实际名称分别是 refs / tags / hotfix-1
和 refs / heads / hotfix-1
但Git允许您使用简写,因为Git允许您在 git merge
语句中使用任何 committish ,所以在这种情况下是不明确的。事实上,当我测试这个场景时,Git合并了标记,而不是分支。
当看着你的 git show-ref - 头--tags
输出,但它不清楚,因为只有一个名为 hotfix-1.0.1
的标签,并且没有同名的分支。看起来你可能随后改变了事情。
I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ;
git checkout master
git merge --no-ff hotfix-1
Created a tag for this point;
git tag -a hotfix-1 -m ""
and then I switched back to develop branch from master and merge 'hotfix-1' with ;
git checkout develop
git merge --no-ff hotfix-1
after merging 'hotfix-1' to develop I'm getting "warning: refname 'hotfix-1' is ambiguous" message and it's successfully merging my changes to develop too.. should I worry about anything ?
Edit
git show-ref --heads --tags
d97bfc563749918799d4659c43f7bffd29cf4d60 refs/heads/develop
594ea85c94f8321d372779ed3dbd5df07bdb059b refs/heads/master
ffc897f8ab19510d5ff4c67969d0f0cb97d1c4f3 refs/tags/beta-1.0
490a8c80ecec70fd2268aa0c2ad7a9beb6bf491c refs/tags/beta-1.1
644adadb43744ad1d2e0f13fc37abb6906520f8f refs/tags/hotfix-1.0.1
4c49e8d9ddc8d601ed794f307e1c29acfc84b31b refs/tags/release-1.0
解决方案 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.
这篇关于Git警告:refname'xxx'不明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!