Home » Source Code Management ( SCM ) » Git » How to delete the remote TAG in git ?

How to delete the remote TAG in git ?

[addthis tool="addthis_inline_share_toolbox"]

We had some source code, to which after doing modifications and commit, we added a tag and pushed the same to remote server, but after this we realized we missed some more modifications in same code which should have been committed with same tag but we already had pushed the tag to remote server.

This case many arise many times, during active development and release cycle in software development. The solution to this is

  • delete the local tag for example TAG_001
  • modify whatever source code you want to modify and commit it
  • create a new tag with same name as previous e.g. TAG_001
  • delete the remote tag e.g. TAG_001
  • push the tag from local repository to remote repository

Delete Local TAG

$ git tag -d "TAG_NAME"

Modify code and create new TAG with same name as above.

$ git tag "TAG_NAME"

Delete the remote TAG,

$ git push --delete origin "TAG_NAME"

Now, push the local tag to remote server,

$ git push origin --tags

Above command will push all the tags to remote server, create a new tag which had same name as previous tag.

Leave a Comment