How to reverse apply a stash?

前端 未结 11 2199
忘掉有多难
忘掉有多难 2020-11-29 14:32

I have a small patch saved away in my git stash. I\'ve applied it to my working copy using git stash apply. Now, I\'d like to back out those changes by revers

11条回答
  •  难免孤独
    2020-11-29 15:23

    In addition to @Greg Bacon answer, in case binary files were added to the index and were part of the stash using

    git stash show -p | git apply --reverse
    

    may result in

    error: cannot apply binary patch to '' without full index line
    error: : patch does not apply
    

    Adding --binary resolves the issue, but unfortunately haven't figured out why yet.

     git stash show -p --binary | git apply --reverse
    

提交回复
热议问题