【发布时间】:2013-08-13 17:34:04
【问题描述】:
我正在尝试重新排序 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
这将我带入 nano:
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
作为错误消息,它不是很有用....有人知道发生了什么吗?
repo 中唯一的文件似乎有冲突:
$ 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
这让我发疯了,感谢任何帮助。
【问题讨论】:
-
您确定将文件重新添加到索引中吗?如果您不这样做,
rebase仍会认为文件存在冲突 -
你必须在 git -rebase -i 之前添加文件?
-
不,你不应该在变基之前添加文件,
git rebase --continue应该在你解决冲突后处理所有事情。
标签: git rebase git-rebase