Created
November 21, 2016 18:21
-
-
Save mat813/670e8bf315582f5ae1f773304340db52 to your computer and use it in GitHub Desktop.
Export/Imports commits from/to a git branch
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
for i in $(git branch|cut -b 3-|sed -e '/^trunk$/d;/^svnadmin$/d') | |
do | |
mkdir -p ../patch/$i | |
git format-patch -o ../patch/$i origin/trunk..$i | |
git show $(head -1 ../patch/$i/0001-*|awk '{print $2}')~1|grep git-svn-id > ../patch/$i/rev-svn | |
done | |
for i in $(find ../patch -name rev-svn|sed -e 's/^..\/patch\///;s/\/rev-svn$//') | |
do | |
rev=$(sed -e 's/.*@\([[:digit:]]*\) .*/\1/' ../patch/$i/rev-svn) | |
gitrev=$(git svn find-rev r$rev trunk) | |
git branch $i $gitrev | |
git branch --set-upstream-to=trunk $i | |
git checkout $i git am --committer-date-is-author-date ../patch/$i/*.patch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment