无法解决rebase冲突

Rom*_*aza 15 git rebase git-rebase

foo:/opt/bar$ git status
# On branch develop
nothing to commit (working directory clean)

foo:/opt/bar$ git pull --rebase origin develop
From ssh://xxx/yyy
* branch develop -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Subscription logging added.
Using index info to reconstruct a base tree...
<stdin>:120: trailing whitespace.
* @return integer
<stdin>:143: trailing whitespace.
* @return integer
<stdin>:166: trailing whitespace.
* @return integer
<stdin>:189: trailing whitespace.
* @return integer
<stdin>:212: trailing whitespace.
* @return integer
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging app/config/config.yml
CONFLICT (content): Merge conflict in app/config/config.yml
Failed to merge in the changes.
Patch failed at 0001 Subscription logging added.

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".

foo:/opt/bar$ git status
# Not currently on any branch.
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: app/config/config.yml
#
no changes added to commit (use "git add" and/or "git commit -a")

foo:/opt/bar$ git add -A

foo:/opt/bar$ git status
# Not currently on any branch.
nothing to commit (working directory clean)

foo:/opt/bar$ git rebase --continue
Applying: Subscription logging added.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

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".

foo:/opt/bar$ git add -A

foo:/opt/bar$ git status
# Not currently on any branch.
nothing to commit (working directory clean)

foo:/opt/bar$ git rebase --continue
Applying: Subscription logging added.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

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".

foo:/opt/bar$
Run Code Online (Sandbox Code Playgroud)

Har*_*rev 42

你是在正确的道路上.您只需要使用跳过您遇到问题的提交:

git rebase --skip
Run Code Online (Sandbox Code Playgroud)

您已修复冲突,但与先前的提交相比,这没有任何变化.在这种情况下,你不能只是git rebase --continue,因为你告诉Git创建一个空提交,这是不允许的.

如果您对任何其他提交有冲突,您仍应使用git rebase --continue.

--skip当您不希望在新生成的历史记录中包含某些提交时,该选项也很有用.

  • 如果 Git 开发人员改进此特定案例的消息以帮助其他人了解该怎么做,那就太好了 (3认同)
  • 这是正确的答案,但我会注意到,在我遇到这个问题的前几次,使用`git rebase --skip`似乎总是很可怕:我真的确定可以跳过这个吗?并且,附注:从技术上讲,空提交*是*可能的,它只需要`--allow-empty`,`git rebase`不提供. (2认同)

Von*_*onC 7

git rebase --skip 确实是正确的解决方案,除非有一种情况会被卡住,并且无法继续使用当前的rebase.

Git的2.0.2(2014年7月)已经修正了错误:看到提交95104c7布赖恩·米 卡尔森(bk2204):

rebase--merge:修复--skip连续两个冲突

如果git rebase --merge遇到冲突,--skip如果下一次提交也发生冲突将无法工作.
msgnum文件永远不会使用新的修补程序编号进行更新,因此实际上不会跳过任何修补程序,从而导致不可避免的循环.

更新msgnum文件的值作为call_merge中的第一件事.
这也避免了Already applied跳过提交时的" "消息.
调用call_merge的其他上下文没有明显的变化,因为msgnum文件的值在这些情况下保持不变.