9

我正在尝试重新排序 2 次提交,并且在没有任何解释的情况下不断收到错误消息,所以我不知道自己做错了什么。

这是回购:

$ git lol
* c0000ca (HEAD, master) added a title
* 132247f Turned colors to html
* 0ddaef3 Added last sentences
* 95f8007 initial commit

我想交换 132247f 和 0ddaef3。

$ git rebase -i 95f8007

这让我进入纳米:

pick 0ddaef3 Added last sentences
pick 132247f Turned colors to html
pick c0000ca added a title

# Rebase 95f8007..c0000ca onto 95f8007
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

我交换两条线,保存并退出。这是我收到的错误消息:

error: could not apply 132247f... Turned colors to html


When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 132247f... Turned colors to html

作为错误消息,它不是很有用....有人知道发生了什么吗?

回购中唯一的文件似乎有冲突:

$ cat poem.md
<<<<<<< HEAD
Roses are red.
Violets are blue.

=======
Roses are #ff0000.
Violets are #0000ff.
All of my bases,
are belong to you.
>>>>>>> 132247f... Turned colors to html

如果我解决了冲突,添加文件并运行 git rebase --continue,我会收到另一个错误:

$ git rebase --continue
[detached HEAD 9aba127] Turned colors to html
 1 file changed, 4 insertions(+), 2 deletions(-)
error: could not apply 0ddaef3... Added last sentences

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 0ddaef3... Added last sentences

这让我发疯,任何帮助表示赞赏。

4

1 回答 1

13

看起来正在发生的事情是,您在应用“将颜色转换为 html”时成功解决了第一个合并冲突,然后在应用下一个提交“添加最后一句话”时遇到了另一个合并冲突。

只需执行 agit status查看合并冲突是什么,解决它们然后继续git rebase --continue.

于 2013-08-13T18:06:29.290 回答