Skip to content

Instantly share code, notes, and snippets.

@rais38
Created June 12, 2013 16:35
Show Gist options
  • Star 55 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save rais38/5766980 to your computer and use it in GitHub Desktop.
Save rais38/5766980 to your computer and use it in GitHub Desktop.
Create patch from stash
git stash show -p stash@{0} > Stash0.patch
@rstriquer
Copy link

It seams not to add unstaged files. Does it?
Cheers, and thanks for share!

@3Nigma
Copy link

3Nigma commented Apr 13, 2022

Thank you, mate!

@vadimcoder
Copy link

Thanks!

@xv
Copy link

xv commented Apr 11, 2023

Won't work from a PowerShell terminal because of the curly braces. The workaround is to wrap stash@{0} in quotes. I.e.,
git stash show -p "stash@{0}" > Stash0.patch

Thanks!

@icewindq
Copy link

very cool. tks.

@henryfung3a27
Copy link

And to apply the patch, git apply path/to/Stash0.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment