DEV Community

Iman Tumorang
Iman Tumorang

Posted on • Originally published at Medium on

Today I Learned: How to Delete Git-Tag Remotely.

A simple command to save your days :)

TLDR;

# delete remotely
$ git push --delete origin tagName

# delete tag in your local
$ git tag -d tagName
Enter fullscreen mode Exit fullscreen mode

Photo by Yancy Min on Unsplash

My daily life is working with Git, in my case Github. Both in my works, and also in my spare time(doing a side project with open-source). Currently, I maintain 2 of my open source projects, they are:

There is a time that I made countless mistakes when releasing a new feature of my projects both in my current job and in my side project. Just like just a few minutes ago before I write this story.

It happens when I want to release one of my open-source projects faker. When releasing it, I accidentally hit my enter keyboard, but I’m not finished yet to specify the version. And that causes the Github to create a new tag there and ruin the order of the semantic versioning from the previous version.

So to fix this, since in the Github we can’t change the tag-name, it’s either to delete it and create one, or just let it be like that. And that’s how I learn a thing about this git tag deletion.

With just a simple command, I can delete a tag remotely and locally.

# delete remotely
$ git push --delete origin tagName

#delete tag in your local
$ git tag -d tagName
Enter fullscreen mode Exit fullscreen mode

But, we also can do this in the Github itself, *TBH, I just figured this, and I think it’s a new feature in Github that I just realized. Since a year ago, I can’t delete a tag in Github, except using my terminal command.

Here’s how to delete a tag with the Github web interfaces.

demo delete Tag with Github

Just it. Hopefully, it can help others :)

https://medium.com/media/81d478571152ec502750529a22011bf8/href


Top comments (0)