Created
November 24, 2013 05:52
-
-
Save schnell18/7623832 to your computer and use it in GitHub Desktop.
Move the remote refs created by the git svn migration tool(git svn clone --no-metadata --authors-file -s) to their local refs
This file contains hidden or 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 entry in $(git for-each-ref --format="%(objectname)|%(refname)") | |
do | |
oldref=$(echo $entry | cut -d '|' -f 2) | |
if [[ $oldref =~ 'remotes' ]]; then | |
sha=$(echo $entry | cut -d '|' -f 1) | |
if [[ $oldref =~ 'remotes/tags' ]]; then | |
newref=$(echo $oldref | sed -e 's/remotes\/tags/tags/') | |
elif [[ $oldref =~ 'remotes' ]]; then | |
newref=$(echo $oldref | sed -e 's/remotes/heads/') | |
fi | |
git update-ref $newref $sha | |
git update-ref -d $oldref | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment