gitpatch

Git error: previous rebase directory .git/rebase-apply still exists but mbox given


I'm trying to apply a patch with Git, but I'm getting this error:

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

What does this error mean and how do I fix it?


Solution

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