Skip to content

Instantly share code, notes, and snippets.

@devxoul
Last active November 11, 2019 12:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devxoul/70838c6057cbead3dfdb to your computer and use it in GitHub Desktop.
Save devxoul/70838c6057cbead3dfdb to your computer and use it in GitHub Desktop.
Replace git tags to semantic version
#!/bin/bash
# Replace git tags to semantic version
# e.g. v1.0.0 -> 1.0.0
for vtag in $(git tag -l | awk '$0 ~ /^v/')
do
tag=$(echo $vtag | sed -e 's/^v//')
git tag $tag $vtag
git tag -d $vtag
git push origin :refs/tags/v$tag
done
git push --tags
@devxoul
Copy link
Author

devxoul commented Nov 30, 2018

A ruby script that removes all tags with 'v' prefix (both local and remote)

tags = `git tag`.split("\n")
tags.each do |tag|
  if tag.start_with?('v')
    `git push --delete origin #{tag}`
    `git tag -d #{tag}`
  end
end

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