Skip to content

Instantly share code, notes, and snippets.

@starstuck
Last active January 2, 2016 09:18
Show Gist options
  • Save starstuck/8281836 to your computer and use it in GitHub Desktop.
Save starstuck/8281836 to your computer and use it in GitHub Desktop.
Convert all git-svn pseudo tag branches to proper tags.
#!/usr/bin/env bash
#
# Following script will work with tags preficed with svn, having mapping like:
# tags = project/tags/*:refs/remotes/svn/tags/*
# If you use differnet paths mapping, you may need to adjust it a bit.
#
git for-each-ref --shell --format='parent=%(parent) refname=%(refname)' refs/remotes/svn/tags/ | \
while read entry
do
eval "$entry"
tagname=${refname##*/}
git tag ${tagname} ${parent}
git branch -rd svn/tags/${tagname}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment