Git un-apply stash?

237 Views Asked by At

I have debug code for couple situations. I store it in stashes. They touches many files. Sometimes in process of coding I need to do debug stash apply.

But after resolving situation there is no way to un-stash temporary "debug2" code back. I should do revert files or in worst case scenario only debug lines of code in classes that I`ve touched previously by hand.

I know that it possible to do first code commit, then debug stash apply and debug commit. And then do third code commit. But it's uncomfortably if I'm not sure that all working changes should go to first code commit.

Is there a way to just un-apply same debug stash code on fly?

Also maybe you know better idea how to work with temporary debug code.

2

There are 2 best solutions below

2
On BEST ANSWER

Here's one example: Un-applying a Stash

git stash show -p | git apply -R
0
On

Another approach to un-apply stash is :

git reset --hard

and after checking out to the branch you choose, run this in your Git Bash:

git clean -d -f