Skip to content

Instantly share code, notes, and snippets.

@pkuczynski
Created December 6, 2013 13:10
Show Gist options
  • Save pkuczynski/7823523 to your computer and use it in GitHub Desktop.
Save pkuczynski/7823523 to your computer and use it in GitHub Desktop.
Renames multiple tags using regexp. Usage: git_rename_tags.sh $frompattern $topattern
#!/bin/sh
shopt -s extglob
for tag in $(git tag -l)
do
newtag=`echo "$tag" | sed -E "s/$1/$2/"`
if [[ $tag != $newtag ]]; then
git tag $newtag $tag
git tag -d $tag
git push origin :refs/tags/$tag
git push --tags
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment