Created
January 31, 2019 17:54
-
-
Save rhaberkorn/ed324a974a7d8fe4a1ec1dde55d60daa to your computer and use it in GitHub Desktop.
Rename an existing remote and local tag at the same time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git-rename-tag <old-name> <new-name> | |
# NOTE: This works on the "origin" remote and preserves | |
# annotations. | |
set -e | |
# Creates a new tag on the remote AND removes the old tag | |
git push origin refs/tags/$1:refs/tags/$2 :refs/tags/$1 | |
# Remove the old local tag | |
git tag -d $1 | |
# Fetch the new tag | |
git fetch origin refs/tags/$2:refs/tags/$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment