Retag a Git Tag
20 Dec 2020 in TIL
The convention when building GitHub Actions is that you have a v1
tag that alway points at the latest release in the v1.x.x
series. In most cases I'm using build-and-tag-action to handle this but in some cases I needed to retag things manually.
To update what a Git tag points to:
bash
# Fetch existing tags# -f is needed in case you previously had a tag.# The action updates an existing tag, so we need to force pullgit fetch —tags -f# Force update a taggit tag -f v1.2.1 7585bee052d6780cc93dfe35bdc5f46baa29500d# Force push this single taggit push origin v1.2.1 --force
If you're updating a tag to point to another tag e.g. v1 = v1.2.3
you can use the new tag name as a reference:
bash
git tag -f v1 v1.2.3git push origin v1 --force