Git Stash Pop Conflict

October 4, 2017

It is true that creating branches in Git are easy and cheap so you don't really need to git stash something. But, sometimes you don't want to save something to a branch because you really want it to be a temporary thing so you stash it.

Sometimes though you'll stash something then merge your feature branch and when you git pop conflict the stash back you'll have a conflict.

You'll see "unmerged paths" which is your clue to this situation.

What to do?

I've found that one path to take is to reset the file to unstage it, fix the conflict then add it back.

$ git reset HEAD [file(s)]

This does, if you notice, leave the stash still around.

When you are ready to get rid of it you can clear it.

$ git stash clear

Tags: git