Git 错误: 前面的 rebase 目录. Git/rebase-application 仍然存在,但是给定了 mbox

我正在尝试应用一个补丁,这是我从 http://www.winehq.org/pipermail/wine-devel/2014-May/104356.html中获得的。我复制到一个文本编辑器,并保存为 my.patch(我需要修复的电子邮件,它已经混淆)。

我试图在 Git 中应用它,但是我得到了这个错误:

sashoalm@sashoalm-VirtualBox:~/Desktop/wine-git$ git am --signoff <my.patch
previous rebase directory /home/sashoalm/Desktop/wine-git/.git/rebase-apply still exists but mbox given.

这个神秘的错误消息让我不知道出了什么问题,也不知道需要做些什么才能让它正常工作。这个错误是什么意思?我该怎么补救?

60085 次浏览

Ok, it turned out I needed to delete the directory .git/rebase-apply. It works after that (or at least gives me different errors, saying the email is wrong again). I still have no idea what the error actually means or why there was an error.

Edit: As the comments below suggest, git am --abort or git rebase --abort might be a better way to fix the problem, but I have not tested it.

git am --abort

worked for me, but git rebase --abort did not.

What happened: I tried to apply a patch but it had been corrupted (likely by Gmail copy pasting in body):

git am bad.patch

And Git said:

Applying: python: fix Linetable case to LineTable in docstrings and comments
fatal: corrupt patch at line 56
Patch failed at 0001 python: fix Linetable case to LineTable in docstrings and comments
The copy of the patch that failed is found in:
/home/ciro/git/binutils-gdb/src/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Note how git gives out the solution: To restore the original branch and stop patching, run "git am --abort".

Then I obviously ignored the message, and tried a fixed version immediately:

git am good.patch

and got the error.