Skip to content

Instantly share code, notes, and snippets.

@rnag
Forked from Frechet/git repush tag
Last active April 2, 2023 23:07
Show Gist options
  • Save rnag/1e2221a5df962fb997083e83ca034762 to your computer and use it in GitHub Desktop.
Save rnag/1e2221a5df962fb997083e83ca034762 to your computer and use it in GitHub Desktop.
# delete and re-create the latest tag on remote
rmtag () {
export TAG=$(git describe --tags --abbrev=0)
git tag -d $TAG
git tag $TAG
git push origin :$TAG
git push origin $TAG
}
1. While still on any branch
# TAG=v1.1
export TAG=$(git describe --tags --abbrev=0)
git tag -d $TAG
2. Create the tag again: This will "move" the tag to point to your latest commit on that branch
git tag $TAG
3. Delete the tag on remote
git push origin :$TAG
4. Create the tag on remote
git push origin $TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment