git - 无法解决 rebase 冲突

标签 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$

最佳答案

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

git rebase --skip

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

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

当您根本不想在新生成的历史记录中包含某些提交时,--skip 选项也很有用。

关于git - 无法解决 rebase 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22814602/

相关文章:

git - rebase - 如果 rerere 解决了所有冲突,则自动继续

git - 在 Git 中切换远程分支

java - Maven thrift 插件 - 如何包含 thrift 定义?

git - 为什么 pull 请求在 rebase 后会显示额外的提交?

git - 我可以一次性 git commit 到父分支 + rebase 吗?

git - 是否可以轻松地将所有提交从一个分支移动到另一个分支作为一个提交?

git - 解决 git rebase 冲突的方式与之前解决冲突的方式相同

git 和 "Server aborted the SSL handshake"错误

git cherry-pick 并通过忽略 EOL 更改进行 merge

perl - 使用git高效地重写(rebase -i)许多历史记录