If you’re trying to pop a stash and Git won’t merge for you because you have changes in your index to the same file(s) (Git needs to use the index to do a merge at all), i.e.:
❯ gsp
error: Your local changes to the following files would be overwritten by merge:
index.html
Please, commit your changes or stash them before you can merge.
Aborting
(In this example, my index contains changes to index.html
, but so does the stash I’m trying to pop.)
A workaround is:
git add .; git commit -m "temp"; git stash pop; git reset --soft HEAD^