On this page

Delete Git tag

What is a Git tag?

Tags are a way of labeling a specific commit in Git as an immutable point in a repository's history. They are usually used to create releases (typically off master/main branch) when all the tested, approved features for a release have been merged in - the last commit after these merges is tagged with a version, for example 1.3.4. Platforms like GitHub will then create downloadable archives from these commit points under your releases for other people or package managers to find.

Should you delete a Git tag?

Not really. The idea of tags is that they are immutable; unlike branches, they are not supposed to change, or have any further history. You can't checkout and modify a tag like a branch, commit, push to it and you shouldn't in principle be deleting tags once they exist, either.

But sometimes you might need to. Maybe you've made a mistake preparing a release (happens to the best of us, right?), maybe you accidentally tagged the wrong version number etc. and now you want to recreate the tag, without leaving the old, incorrect tag hanging around.

Fortunately, while it is arguably a bug in Git that you are able to delete a tag, it is possible.

Delete a Git tag on your local machine

Deleting a local tag is simple.

# Fetch all tags from remote
git fetch --tags
# To delete a tag
git tag -d <tag>
# Example
git tag -d 1.3.4

Delete a Git tag on remote

There are two syntactical flavours to delete a Git tag remotely:

# Assuming origin is your primary remote
git push origin :ref/tags/<tag>
# E.g.
git push origin :ref/tags/1.3.4
# Alternatively...
git push --delete origin 1.3.4

Further reading

Atlassian have a decent Git tag tutorial


Add a comment

All comments are pre-moderated and will not be published until approval.
Moderation policy: no abuse, no spam, no problem.

You can write in _italics_ or **bold** like this.

Recent posts

Saturday 15 October 2022, 15:31

A bit about binary (pun intended!) to put a twist on a classic learning puzzle.

php coding

Monday 10 October 2022, 07:15

I'll say it - web 3.0 is a meaningless buzzword, and blockchain and cryptocurrency is nothing more than a giant fraud.



Buy this advertising space. Your product, your logo, your promotional text, your call to action, visible on every page. Space available for 3, 6 or 12 months.

Get in touch

Friday 07 October 2022, 23:30

Challenging the present day orthodoxy on web application architecture.

musings coding

Monday 19 September 2022, 20:36

Learn how to make use of Doctrine lifecycle events to build a searchable audit log for your application which records an entry whenever an entity's data is changed.


Saturday 10 September 2022, 21:40

Learn all about OAuth2, OIDC, plus build an AWS Cognito style single sign on app.

php coding