I have added a wrapper for git stash show -p <stash> > patch
. It's available from the stash popup now (z f).
But note that a stash commit consists of two or three commits, and that one of these commits is a merge commit. What this command does, is to save the diff for stash@{N}^..stash@{N}
to a file. The intermediate index (stash@{N}^2
) is lost, and if the work tree commit does not only "adds" additional changes, but instead further "changes" the changes in the index commit, then those changes in the index are completely lost.
In the comments it was suggested that it should be possible to apply the individual commits that make up the stash as presented in the stash buffer, but that wasn't the case because the wrong section type was used. I have changed the section type to commit
, but that doesn't make it possible to create a patch from the worktree commit, because that is a merge commit and no patches can be created from merge commits.