How to reverse apply a stash?

前端 未结 11 2200
忘掉有多难
忘掉有多难 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:09

    This is long over due, but if i interpret the problem correctly i have found a simple solution, note, this is an explanation in my own terminology:

    git stash [save] will save away current changes and set your current branch to the "clean state"

    git stash list gives something like: stash@{0}: On develop: saved testing-stuff

    git apply stash@{0} will set current branch as before stash [save]

    git checkout . Will set current branch as after stash [save]

    The code that is saved in the stash is not lost, it can be found by git apply stash@{0} again.

    Anywhay, this worked for me!

提交回复
热议问题