如何解决与 git-svn 的冲突?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/112839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:04:01  来源:igfitidea点击:

How to resolve a conflict with git-svn?

gitsvnmergeconflict

提问by csexton

What is the best way to resolve a conflict when doing a git svn rebase, and the git branch you are on becomes "(no-branch)"?

在执行 a 时解决冲突的最佳方法是什么git svn rebase,并且您所在的 git 分支变为“(无分支)”?

采纳答案by 1800 INFORMATION

You can use git mergetoolto view and edit the conflicts in the usual fashion. Once you are sure the conflicts are resolved do git rebase --continueto continue the rebase, or if you don't want to include that revision do git rebase --skip

您可以使用git mergetool以通常的方式查看和编辑冲突。一旦您确定冲突已解决,请git rebase --continue继续执行变基,或者如果您不想包含该修订,请执行git rebase --skip

回答by csexton

While doing a git svn rebase, if you have merge conflicts here are some things to remember:

在执行 a 时git svn rebase,如果您遇到合并冲突,请记住以下几点:

1)If anything bad happens while performing a rebase you will end up on a (no-branch)branch.

1)如果在执行 rebase 时发生任何不好的事情,你最终会出现在一个(no-branch)分支上。

2)If you run git status, you'll see a .dotestfile in your working directory. This is safe to ignore.

2)如果运行git status,您将.dotest在工作目录中看到一个文件。这可以安全地忽略。

3)If you want to abort the rebase use the following command.1

3)如果要中止变基,请使用以下命令。1

git rebase --abort

4)If you have a merge conflict:

4)如果你有合并冲突:

  1. Manually edit the files to resolve the conflicts
  2. Stage any changes with git add [file]
  3. Continue the rebase with git rebase --continue2
    • If git asks: "did you forget to call git add?", then the edits turned the conflict into a no-op change3. Continue with git rebase --skip
  1. 手动编辑文件以解决冲突
  2. 暂存任何更改 git add [file]
  3. 2继续 rebasegit rebase --continue
    • 如果 git 询问:“你忘记打电话了git add吗?”,那么编辑将冲突变成了无操作更改3。继续git rebase --skip

You may have to repeat this process until the rebase is complete. At any point you can git rebase --abortto cancel and abandon the rebase.

您可能必须重复此过程,直到 rebase 完成。您可以git rebase --abort随时取消和放弃变基。



1: There is no --abortoption for git svn rebase.

1:没有--abort选项git svn rebase

2: There is no --continueoption for git svn rebase.

2:没有--continue选项git svn rebase

3: This is very strange, but the files are in a state where git thinks they are the same after that particular patch. The solution is to "skip" that patch on the rebase.

3:这很奇怪,但是文件处于 git 认为在该特定补丁之后它们相同的状态。解决方案是在 rebase 上“跳过”那个补丁。