Last active
December 24, 2015 15:49
-
-
Save eLafo/6823624 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
echo "Creating tags" | |
for tag in `git branch -r | grep "tags/" | egrep -vw "svn/tags/(integration|production)" | sed 's/ tags\///'`; do | |
git_tag_name=`echo "$tag" | sed 's/tags\///'` | |
parents=`git show --format="%P" refs/remotes/$tag` | |
real_parent=`echo "$parents" | cut -d' ' -f 2` | |
git tag -a -m"Converting SVN tags" $git_tag_name $real_parent | |
done | |
echo "Creating integration and production branches" | |
for tag in `git branch -r | egrep -w "svn/tags/(integration|production)" | sed 's/ tags\///'`; do | |
git_tag_name=`echo "$tag" | sed 's/tags\///'` | |
#We get the tag from which the integration/production tag was created | |
parents=`git show --format="%P" refs/remotes/$tag` | |
tag_parent=`echo "$parents" | cut -d' ' -f 2` | |
#We get the real commit from wich the previous tag was created | |
parents=`git show --format="%P" $tag_parent` | |
tag_parent=`echo "$parents" | cut -d' ' -f 2` | |
real_commit=`echo "$tag_parent" | cut -d' ' -f 2` | |
branch_name=${tag##*/} | |
git branch $branch_name $real_commit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment