git svn rebase与git中不存在的文件冲突失败

时间:2010-10-04 12:28:25

标签: svn git

我目前正在开发一个关于git-hub的项目,但我们的开发团队正在使用subversion。我一直在做以下事情以保持git-hub与我们的svn存储库同步:

git svn rebase
git pull origin master
git push origin master

这个工作正常,但不知怎的,我搞砸了一些事情,现在我在使用rebase时遇到一个文件有问题:

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ git svn rebase
First, rewinding head to replay your work on top of it...
Applying: minor fix to table class
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: remove README, will re-add via svn
Applying: trying to fix readme
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging README
CONFLICT (add/add): Merge conflict in README
Failed to merge in the changes.
Patch failed at 0020 adding README file

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

rebase refs/remotes/trunk: command returned error: 1

我必须删除并重新添加git和/或svn中的文件,现在我遇到了这个问题。奇怪的是,README文件没有出现在我当前的git master中。我尝试从我的svn trunk中删除它,但这没有区别。我已解决冲突并重新添加文件等无济于事。我甚至删除了我当地的git并重新开始。某些东西必须被破坏。

我也试过git rebase --skip,但这给了我:

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ git rebase --skip
HEAD is now at c4da146 trying to fix readme
Applying: remove README, will re-add via svn
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
CONFLICT (delete/modify): README deleted in remove README, will re-add via svn and modified in HEAD. Version HEAD of README left in tree.
Failed to merge in the changes.
Patch failed at 0021 remove README, will re-add via svn

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

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ 

有谁知道如何解决这个问题?这让我发疯了。我根本不需要README文件,因此我不在乎是否只需要将其吹掉并重新创建它。谢谢!

1 个答案:

答案 0 :(得分:3)

你试过git rebase --skip吗?维护一个单独的git repo会很容易出错。 git dcommit重写您的本地git提交(即更改SHA-1校验和)。因此,在您的正常工作流程中:

  • 更改代码
  • 提交给github
  • 更改代码
  • 提交给github
  • git svn rebase
  • git pull origin master
  • git push origin master
  • git svn dcommit

git pull执行两项操作,git fetch后跟git merge。合并可能很麻烦。此外,在最后一个dcommit中,本地git提交已更改,不再匹配上一个命令中推送到github的内容。

您可以阅读git-svn here