I'm trying to do a "git stash pop" with a binary file. It results in a merge conflict. I just want to pull what's in the stash off and overwrite what's in the working directory. What is the easiest way to do that?
Asked
Active
Viewed 4,411 times
10
-
1Not sure if it's a duplicate exactly, but [this answer might help you](http://stackoverflow.com/a/3733698/2812842) – scrowler Apr 30 '15 at 22:58
-
Hmm... well, the working branch (or the file in question) isn't dirty. It was just changed in another branch before being merged in, and the file in the stash doesn't have the merged in changes. – Mr Mikkél Apr 30 '15 at 23:09
-
It's a suggested method for using a `--force` approach to `git stash pop` - give it a try anyway :) – scrowler Apr 30 '15 at 23:14
1 Answers
20
To restore all files to their stashed version:
$ git checkout stash -- .

Alex Pan
- 4,341
- 8
- 34
- 45
-
-
1This was a great tip. I had a merge conflict on a binary file when un-stashing and I could not figure out how to take the stashed version of the binary file. – jlyonsmith Nov 14 '15 at 01:14
-
Got the same problem with a docx document, this checkout worked great. Thanks. – damorin Apr 06 '17 at 17:20
-
Finally something that does the trick! The common `git stash apply` doesn't really work with binary files. Thanks! – Óscar Gómez Alcañiz Mar 13 '19 at 16:03