This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.
git stash show -p > patch
You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.
cd /new/project/dir
git apply /old/project/dir/patchfile
git stash
@dermoth I wondered why you were even tagging the commits, since
git fetch
is able to retrieve individual commits, as long as you use full hashes.To transfer all stashes from an old repository to a new one, you can (on zsh):
or on BSD-alike, like MacOSX,
EDIT: Fixed erroneous command
rev
and replaced withtac
andtail -r
depending on the flavour.