This script will:
- Search for git tag with names starting with a the year 2018 followd by a hypen character (
grep ^2018-
).
Make sure to change the year in the script with the year you want to match.
- Then it will create a new tag using the year
2018/´followed by the origina tag name. Ex.: 2018/2018-01-20 Release 2
. - The it will delete the original tag.
git tag -l |grep ^2018- | while read t; do git tag "2018/"$t; git push --tags ; git tag -d $t; git push origin :refs/tags/$t ; done
If you just want to bulk delete all tags starting on
2018-
on Origin, you can use this command:
git tag -l |grep ^2018- | while read t; do git tag -d $t; git push origin :refs/tags/$t ; done
The rest of the team can then clean their local lists of tags, and then pull all online origin tags anew.
- Clean local tags:
git tag -d $(git tag)
. - Pull origin tags anew:
git pull --tags
.