Skip to content

Instantly share code, notes, and snippets.

@OliverJAsh
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OliverJAsh/9655137 to your computer and use it in GitHub Desktop.
Save OliverJAsh/9655137 to your computer and use it in GitHub Desktop.
`git stash pop` not merging

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^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment