git svn rebase总是与我自己的提交冲突

时间:2012-03-13 22:29:30

标签: git svn git-svn

我正在使用git svn与拥有svn存储库的客户端(我们的东西在github中)。

所以我按照说明操作git svn rebase然后git svn dcommit

这是第一次工作,但从那时起,几乎每次提交都会发生冲突。似乎它没有意识到哪些提交是我的,并抱怨事情是相互矛盾的。每次我必须git 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".

1 个答案:

答案 0 :(得分:7)

我不知道你是如何陷入这种状况的,但我可以告诉你如何让自己脱身。

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

然后,检查出来:git checkout mynewbranch

最后,樱桃挑选新分支的提交,这些提交未提交给SVN (类似git cherry-pick refs/remotes/oldbranch..oldbranch

你所看到的问题的最可能原因是你在改变SVN之后重写了历史;当您使用git-svn进行提交时,它会将git-svn-id 放入提交日志,这会更改修订哈希值。如果然后移动提交,则开始在备用Universe中工作,其中SVN版本与非SVN本地版本冲突。