If I run
git format-patch -1 stash@{0}
git returns silently without creating any file. Why does this happen? How can I save a stash in a format compatible with git am?
This seems to be because the stash commit is represented as a merge (between its parent and the index state at the time), and format-patch on a merge commit does nothing.
If you say
git format-patch stash@{0}{,^}
then it will spit out patches between the stash and each parent.
For illustration, this is what the stash looks like:
* 99aedb8 (refs/stash) WIP on master: 668ff36 initial commit
|\
| * 6b8d77f index on master: 668ff36 initial commit
|/
* 668ff36 (HEAD, master) initial commit
You could try
git stash show -p > ~/Desktop/stash.patch
This will generate a patch file on your desktop for the latest patch and the original parent.
Described in the documentation of git-stash under the show option
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With