Skip to content

Instantly share code, notes, and snippets.

@kijart
Created September 10, 2019 08:17
Show Gist options
  • Save kijart/d01d40287e1ecbc4b48fff777cd0d427 to your computer and use it in GitHub Desktop.
Save kijart/d01d40287e1ecbc4b48fff777cd0d427 to your computer and use it in GitHub Desktop.
Rename git tag

How to rename a GIT tag in the remote repo? Some times we would have added a tag, pushed it to remote and then realized that we’d named it wrong. Ex. VER_7_2_0 instead of VER_7_1_2.

Here is quick tip to rename a git tag in the remote repo.

Step 1: Create a new tag on the same commit point of old tag and push it, git tag new_tag old_tag git push --tags

Step 2: Delete the old tag from local repo. git tag -d old_tag

Step 3: Delete the old tag from remote repo. git push origin :refs/tags/old_tag

You can verify the changes made, by executing the below command. It shows all remote tags: git ls-remote --tags origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment