Last active
February 7, 2024 13:08
-
-
Save yrtimiD/93fb3b5527ba1c8fd69745ed2735de22 to your computer and use it in GitHub Desktop.
Migrate stashes between git repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
refs=$(git stash list|cut -d: -f1) | |
for ref in $refs; do | |
patchname=`git show -s --pretty=%f $ref`.patch | |
echo $patchname | |
git stash show -p $ref > $patchname; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set -x | |
for patch in *.patch; do | |
echo "Importing $patch" | |
git apply $patch | |
if [ $? -eq 0 ]; then | |
git stash push -m "${patch/%.patch/}" | |
if [ $? -eq 0 ]; then | |
echo "Deleting $patch" | |
rm $patch | |
fi | |
else | |
echo "Skipping $patch" | |
fi | |
read -n 1 -p "next?" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment