2012-03-13 185 views
8

我使用git svn与拥有svn存储库(我们的东西在github中)的客户端一起工作。git svn rebase总是与我自己的提交冲突

所以我按照指示,做一个混帐SVN变基,然后混帐SVN dcommit

这工作的第一次,但从那时起基础重建总是冲突几乎每一个承诺。它似乎没有意识到哪些提交是我的,并且抱怨事情是相互冲突的。每次我必须通过rebase - 跳过我的方式,直到它通过并成功应用我的最新提交。它永远不会知道我最后一次进行重新设定的位置(我相信这是应该发生的事情)。

首先...为什么?那么我能以某种方式解决这个问题吗?

First, rewinding head to replay your work on top of it... 
Applying: Deleting their old build management stuff as its pretty crappy. Will re-build at some point. 
Using index info to reconstruct a base tree... 
Falling back to patching base and 3-way merge... 
No changes -- Patch already applied. 
Applying: Added some error checking around Android specific calls 
Using index info to reconstruct a base tree... 
<stdin>:16: space before tab in indent. 
      Android.hideKeyboard(); 
<stdin>:31: space before tab in indent. 
        Android.launchNewAccount(); 
warning: 2 lines add whitespace errors. 
Falling back to patching base and 3-way merge... 
CONFLICT (modify/delete): src/LoginForm.js deleted in HEAD and modified in Added some error checking around Android specific calls. Version Added some error checking around Android specific calls of src/LoginForm.js left in tree. 
Auto-merging src/ChildPanel.js 
CONFLICT (content): Merge conflict in src/ChildPanel.js 
Failed to merge in the changes. 
Patch failed at 0002 Added some error checking around Android specific calls 

When you have resolved this problem run "git rebase --continue". 
If you would prefer to skip this patch, instead run "git rebase --skip". 
To check out the original branch and stop rebasing run "git rebase --abort". 

回答

7

我不知道你是怎么陷入这种情况的,但我可以告诉你如何让自己出门。

首先,根据上游SVN创建一个新分支:git checkout -b mynewbranch refs/remotes/oldbranch(这里使用git-svn ref ID)。请参考:git checkout mynewbranch

最后,从你的新分支这并没有承诺SVN(类似git cherry-pick refs/remotes/oldbranch..oldbranch摘樱桃的提交。

您遇到的问题最可能的原因是,你推后改写历史对SVN进行更改;当您使用git-svn进行提交时,它会将git-svn-id置于提交日志中,该提交日志会更改修订哈希值。如果您随后移动提交文件,则开始在SVN版本的备用Universe中工作与非SVN本地冲突。

+1

哈哈。爱你的开场白。我会给这个镜头谢谢! – 2012-03-13 23:03:19

+1

我假设由git-svn ref ID表示分支名称'remotes/git-svn'? – 2012-03-13 23:06:30

+1

呃... git co不是命令。我假设git checkout? (只要确保我没有在那个时候使用git svn) – 2012-03-13 23:07:17