2011-02-08 152 views
1

我想一个git rebase - 导致冲突 - 为什么?

git rebase --onto master myremote/master~21 myremote/master 

从远程仓库添加对矿井最新的21个提交。

什么git告诉我的是有冲突 - 但那可能怎么样?

根据我的理解,这只是将21承诺并将其应用于我的主人之上。怎么会有冲突?

感谢您的帮助!

我在做那个顺便说一句,因为不知何故,我搞砸了我的git-svn仓库(远程),并且有21个提交,我没有管理提交颠覆。所以我试着用一个新的git-svn克隆,我在其中添加了这21个提交。

回答

0

有冲突,如果:

  • 主有承诺不在myremote/master
  • 这些提交包含通用文件/更改与最后一个提交21 myremote/master

如果莫名其妙新鲜git-svn clone有不同的SHA1比以前的git - svn的回购协议,那么就没有接近共同祖先,而冲突的机会要高得多。
有关rebase期间冲突的说明,请参阅“How to identify conflicting commits by hash during git rebase?”。重置您的本地主人myremote


单程/主人将是:

git checkout -b tmp myremote/master # local tmp branch from myremote/master HEAD. 
git merge -s ours master    # ignore completely master content 
git checkout master 
git merge tmp      # fast-forward to tmp HEAD 

如果您还没有获取myremote/master前作了当地master任何更改,这应该工作。

+0

我不明白。为什么要提交主要的问题? rebase只是将当前分支(这里是myremote/master)重置为(这里是master)。所以一切都应该应用在主人的头上,对吧? – Andy

+0

换句话说:没有一种方法可以简单地应用这21个提交,而不需要对共同的祖先和废话进行git检查吗? – Andy

+0

@Andy:对于rebase期间的冲突,请参阅http://stackoverflow.com/questions/2118364/how-to-identify-conflicting-commits-by-hash-during-git-rebase。你的情况的问题是:'master/HEAD'的SHA1(在任何rebase之前)是否与'myremote/master_22'相同?如果不是这样,共同的祖先进一步落后于“主人”的历史,因此所有这些冲突。 – VonC