我使用git-svn来管理我的bugfix分支,但它告诉我有未合并的更改,即使我直接查看SVN代码库,我也可以看到它们已经提交。这就像是错误修复的rebase没有将分支设置为合并。
我到底做错了什么?
git checkout -b fix_bug_1234
git add .
git commit -m "first change"
git add .
git commit -m "second change"
git rebase -i HEAD~2 // squash the two changes together
git svn rebase // fetch any changes from svn
git checkout master
git rebase fix_bug_1234
git svn dcommit
git branch -d fix_bug_1234
error: The branch 'fix_bug_1234' is not fully merged.发布于 2011-03-24 07:16:19
这样做的原因是git rebase更改了提交对象。因此,虽然实际内容(或差异)与那些重新定位的提交相同,但它们引用的是不同的父对象,因此是不同的。
这样,git branch -d就无法验证这些提交的更改是否包含在其他提交中。然后您需要使用git branch -D (大写D)来强制删除。
顺便说一句:git svn dcommit和rebasing有相同的效果。当dcommit将提交推送到SVN服务器时,它随后会再次从SVN服务器获取提交。所以你最终得到了与你推送的对象不同的对象。尽管它们在内容上可能是相同的(除非您有冲突),但它们仍然不同(主要原因是git svn在提交消息中添加了一行,说明提交所属的SVN版本)。
发布于 2011-03-24 07:35:46
这就是我做这类事情的方法,它是有效的。来自user poke的答案解释了为什么git rebase不能按您希望的那样运行。
git rebase -i HEAD~2 // squash the two changes together
git svn rebase // fetch any changes from svn
git svn dcommit // you can commit to SVN from any branch
git checkout master
git svn rebase
git branch -d fix_bug_1234https://stackoverflow.com/questions/5412599
复制相似问题