How to delete Git tags?

In Git, tags are used to mark “commits” that are more important than others. They are used, for example, to highlight important events such as bug fixes and releases.

Now and then, of course, it can happen that you want to delete a tag again, for whatever reason.

Deleting local Git tags #

To delete a local tag you can use the following command:

git tag -d <tag_name>

I usually name my tags after the version of the application, e.g.: v0.15. So now if I want to delete exactly this tag, I enter the following:

git tag -d v0.15

If you are no longer sure which name you used, you can simply view your tags as follows:

git tag -l

You will also get a message if you specify a tag that does not exist:

error: tag <tag_name> not found.

Deleting Git tags in the remote directory #

To delete a Git tag from a remote directory, you can specify the following command:

git push --delete <branch> <tag_name>

For example, if you want to delete the tag “v0.15” from the branch “master” you can do this as follows:

git push --delete origin/master v0.15

I hope this article could help you. If you have any questions or feedback, feel free to leave a comment.

Hier klicken, um den Beitrag zu bewerten
[Gesamt: 0 Durchschnitt: 0]

Leave A Comment

Title