git-rename-tag
Rename an existing Git tag
TLDR
Rename an existing Git tag locally and remotely
SYNOPSIS
git rename-tag
PARAMETERS
The name of the tag to be renamed.
The desired new name for the tag.
DESCRIPTION
The git-rename-tag command allows you to rename an existing tag in a Git repository. This is useful for correcting typos, clarifying tag names, or updating the tagging scheme. It works by creating a new tag with the desired name pointing to the same commit as the old tag, and then deleting the old tag. Because tags, once published, should be considered immutable, this command is primarily intended for use on local, unpublished tags. Renaming a published tag will break history for anyone who has already fetched the old tag. git-rename-tag refuses to rename a tag when the old tag and the new tag name differ only in case. This command can also be used to move a tag from one branch to another, but it should only be attempted on local tags. If you need to rename a tag that's already been pushed to a remote repository, you will need to delete the old tag from the remote and push the new tag. This involves using git push with the --delete option, and then pushing the newly renamed tag.
CAVEATS
Renaming a tag that has already been pushed to a remote repository is strongly discouraged, as it can cause issues for other users who have already fetched the old tag. It requires deleting the tag on the remote and pushing the new tag, which can be disruptive.
RENAMING WORKFLOW
1. git rename-tag old_tag new_tag
2. If you want to rename remote tag:
git push --delete origin old_tag
git push origin new_tag
SEE ALSO
git tag(1), git push(1)