Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

mijdavis2 commented May 15, 2018

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