Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git 2 svn : create tag
#!/bin/bash
# set -x
for t in `git tag` ; do git tag -d $t > /dev/null ; done
for branch in `git -c "color.ui"=false branch -r`; do
if echo "$branch" | \grep -v "^tag" 2>&1 >/dev/null ; then
continue
fi
tag=`echo $branch | sed -e 's/.*_/v/' -e 's/.*v/v/'`
commit=`git log -1 --pretty="%H" remotes/$branch | cat`
message=`git log -1 --pretty="%s" remotes/$branch | cat`
previous_commit=`git log -1 --pretty="%H" $commit^ | cat`
git tag $tag -a -f -m "$message" $previous_commit > /dev/null
done
echo 'Good'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment