Skip to content

Instantly share code, notes, and snippets.

@VersionMismatch
Created March 30, 2015 21:36
Show Gist options
  • Save VersionMismatch/7d8e33cbc6d15ffdb0c7 to your computer and use it in GitHub Desktop.
Save VersionMismatch/7d8e33cbc6d15ffdb0c7 to your computer and use it in GitHub Desktop.
Export git stashes to patch files using the stash name as the file name
git stash list| sed 's/\//\_/g'|sed 's/ /\_/g' | awk -F ":" '{ system("git stash show -p " $1 " >> " $1$2$3 ".diff" ) }'
@cdeutsch
Copy link

cdeutsch commented May 2, 2018

This was useful. Thanks!!

@DanielGibbsNZ
Copy link

DanielGibbsNZ commented Jun 4, 2018

If the stash description has a ( in it this will fail. I fixed it using:

git stash list| sed 's/\//\_/g'|sed 's/ /\_/g' | awk -F ":" '{ system("git stash show -p " $1 " >> \"" $1$2$3 ".diff\"" ) }'

@ryancwalsh
Copy link

@VersionMismatch and @DanielGibbsNZ This is so helpful. Thank you!

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