Why is stash not popped after successful project update?

Answered

Did an update this morning on my project and there was a small merge to do. Afterwards I notice that my git stashes are not empty. Is it true that a stash entry is left whenever there is a merge (even if merge is done and update successful)? I would rather these old stashes were not kept around as it can be confusing later.

As an aside this stemmed from an error trying to update when IDEA showed:

Your local changes would be overwritten by merge. Commit, stash or revert them to proceed

This message doesn't make a lot of sense to me because IDEA is meant to have already stashed local changes before tying to do the pull. Me and a colleague have both seen this message from time to time and it causes no end of confusion when it happens. I'd love to understand why it happens...

1 comment
Comment actions Permalink
Official comment

If a merge conflict happens during `git stash pop`, then the stash is not deleted. Git behaves this way, and it is reasonable, because otherwise user would loose the original data if they decide to re-resolve the conflict. The stash should be removed if the conflict happened during merge or rebase.

 

Your local changes would be overwritten by merge.

This shouldn't normally happen, but it is hard to guess without any details. If this happens, please open a ticket at https://youtrack.jetbrains.com/ , describe what happens, and attach the log file.

Please sign in to leave a comment.