Skip to content

Instantly share code, notes, and snippets.

@lyrixx
Created September 25, 2012 14:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyrixx/3782266 to your computer and use it in GitHub Desktop.
Save lyrixx/3782266 to your computer and use it in GitHub Desktop.
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