Skip to content

Instantly share code, notes, and snippets.

@ahmednuaman
Created June 25, 2014 11:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ahmednuaman/19864492a0405977b855 to your computer and use it in GitHub Desktop.
Save ahmednuaman/19864492a0405977b855 to your computer and use it in GitHub Desktop.
Remove the v from git tags
for tag in $(git tag)
do
git tag "${tag/v/}" $tag
done
for tag in $(git tag)
do
if [[ $tag = *v* ]]
then
git tag -d $tag
fi
done
for tag in $(git tag)
do
git push origin :refs/tags/v$tag
done
git push --tags
@mijdavis2
Copy link

In case you only want to delete tags that start with v:

for tag in $(git tag)
do
  if [[ $tag =~ ^v.*$ ]]
  then
    git tag "${tag/v/}" $tag
  fi
done

for tag in $(git tag)
do
  if [[ $tag =~ ^v.*$ ]]
  then
    git tag -d $tag
  fi
done

for tag in $(git tag)
do
  git push origin :refs/tags/v$tag
done

git push --tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment