Home Software Engineering How To Delete Local and Remote Tags on Git

How To Delete Local and Remote Tags on Git

by schkn

On Git, tags are often used in order to tag specific commits that may be more important than others.

Tags may be used in order to bookmark certain events : releases, bug-fixes or just to add an informative and descriptive note to a commit.

On GitHub, tags are often associated with actual product releases for example.

However, in some cases, you may want to delete Git tags easily locally or remotely.

Delete a local Git tag

In order to delete a local Git tag, use the “git tag” command with the “-d” option.

$ git tag -d <tag_name>

For example, if you wanted to delete a local tag named “v1.0” on your commit list, you would run

$ git tag -d v1.0
Deleted tag 'v1.0' (was 808b598)

If you try to delete a Git tag that does not exist, you will simply be notified that the tag does not exist.

$ git tag -d v2.0
error: tag 'v2.0' not found.

If you want to make sure that tags were correctly deleted, simply list your existing tags using the tag command and the “-l” option.

$ git tag -l

Delete a remote Git tag

In order to delete a remote Git tag, use the “git push” command with the “–delete” option and specify the tag name.

$ git push --delete origin tagname

Back to the previous example, if you want to delete the remote Git tag named “v1.0”, you would run

$ git push --delete origin v1.0

To https://github.com/SCHKN/repo.git
 - [deleted]         v1.0

To delete a remote Git tag, you can also use the “git push” command and specify the tag name using the refs syntax.

$ git push origin :refs/tags/<tag>

Back to the example, in order to delete a tag named “v1.0”, you would run

$ git push origin :refs/tags/v1.0

To https://github.com/SCHKN/repo.git
 - [deleted]         v1.0

Why should we specify the “refs/tags” instead of just specifying the tagname?

In some cases, your tag may have the same name as your branch.

If you tried to delete your Git tag without specifying the “refs/tags” you would get the following error

$ git push origin :v1.0

error: dst refspec v1.0 matches more than one.
error: failed to push some refs to '<repository>'

As a consequence, you need to specify that you are actually trying to delete a Git tag and not a Git repository.


In this tutorial, you learnt how you can easily delete a local and a remote Git tag.

If you are curious about Git, we wrote other tutorials on the subject :

Also if you are interested in software engineering, we have a complete section dedicated to it on the website, have a look!

You may also like


Links 6/11/2019: Ubuntu Touch, Sailfish OS Torronsuo and WordPress 5.3 RC4 | Techrights November 6, 2019 - 7:05 pm

[…] How To Delete Local and Remote Tags on Git […]

Vivek November 16, 2019 - 7:51 pm

Thank you for the guide

Worked very well!!

How To Checkout Git Tags – devconnected November 23, 2019 - 5:38 pm

[…] How To Clear Git Cache APT Package Manager on Linux Explained How To Check RAM on Linux How To Delete Local and Remote Tags on… Home Software Engineering How To Checkout Git Tags Software […]

Roozbeh June 3, 2020 - 3:11 pm

Very straight-forward. Thank you!

cpt.coolwine April 28, 2021 - 11:42 am

This was very helpful! i thought i was stuck with my tags… but then i found this.

Burcu September 23, 2021 - 2:39 pm

Thank you! Keep up the good work!

Govind March 30, 2022 - 5:01 pm

When deleting a tag using the refs syntax why don’t you specify delete?

$ git push origin :refs/tags/v1.0

$ git push –delete origin :refs/tags/v1.0

zhangli October 11, 2022 - 3:27 pm

Thank you very much, it helped me a lot!

Blaine October 28, 2022 - 12:51 pm

The instructions here give the false impression that “-d” should be used for local tag operations and “–delete” for remote tag operations. “-d” and “–delete” are equivalent and interchangeable.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.