git中rebase或merge失败的原因:warning: refname ‘<branch name>‘ is ambiguous.
·
背景
现在有分支a和分支b。b是从a的某个历史commit中checkout出来的。在b上进行了开发后,要merge到a。这时最好先rebase到a,然后提交pull request。
问题表现
对本地分支a进行了git pull后,在checkout到分支b,然后执行git rebase a。出现标题的warning,然后显示Current branch b is up to date.
检查git log发现分支a的后续commit并未被merge到分支b来。若使用git merge a,结果一样。
解决方案
$ git show-ref a
<commit hash> refs/heads/feature/a
<commit hash> refs/remotes/origin/feature/a
<commit hash> refs/tags/feature/a
ambiguous是由于本地同时存在名为a的分支和标签。现在移除标签
git tag -d a
重新rebase即可
git rebase a
更多推荐

所有评论(0)