How to delete Git tags?

Marc Wag­ner

Octo­ber 28, 2020

1 min read|

In Git, tags are used to mark “com­mits” that are more important than others. They are used, for exam­p­le, to high­light important events such as bug fixes and releases.

Now and then, of cour­se, it can hap­pen that you want to dele­te a tag again, for wha­te­ver reason.

Deleting local Git tags #

To dele­te a local tag you can use the fol­lo­wing com­mand:

git tag -d <tag_name>

I usual­ly name my tags after the ver­si­on of the appli­ca­ti­on, e.g.: v0.15. So now if I want to dele­te exact­ly this tag, I enter the fol­lo­wing:

git tag -d v0.15

If you are no lon­ger sure which name you used, you can sim­ply view your tags as fol­lows:

git tag -l

You will also get a mes­sa­ge if you spe­ci­fy a tag that does not exist:

error: tag <tag_name> not found.

Deleting Git tags in the remote directory #

To dele­te a Git tag from a remo­te direc­to­ry, you can spe­ci­fy the fol­lo­wing com­mand:

git push --delete <branch> <tag_name>

For exam­p­le, if you want to dele­te the tag “v0.15” from the branch “mas­ter” you can do this as fol­lows:

git push --delete origin/master v0.15

I hope this artic­le could help you. If you have any ques­ti­ons or feed­back, feel free to lea­ve a com­ment.

88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar