Sometimes I git pop
and get things I don't want to merge and want to throw away. Is there a better way throwing away that stash than what I'm currently doing:
git stash pop
Decide I don't want the stash.
git reset HEAD
git checkout -- .
git stash drop
If I pop but don't merge the stash stays, which is why I drop it.
You don't have to do the git reset HEAD
and git checkout --
etc ( which in itself is verbose, as you can just do git reset --hard
to get a clean working directory) to drop a stash. You just have to do git stash drop
and the stash will be dropped. Note that when you pop and git can't apply cleanly, the stash is not popped and is still there. You are then dropping it after cleaning up, which is not necessary.
You might also want to use the branch
option of git stash
if you are facing lots of conflicts. It will create a new branch off the HEAD where you stashed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With