91

Is it possible to untag a revision that has been push upstream using git.

This is what has happened:

 git tag 1.1
 git push --tags origin master

Doh! That was meant to be version 1.1beta

Can you rebase and repush upstream. No other member of my team has pulled from origin yet.

serby
  • 4,186
  • 2
  • 24
  • 25
  • 3
    possible duplicate of [How to delete a remote git tag?](http://stackoverflow.com/questions/5480258/how-to-delete-a-remote-git-tag) – BuZZ-dEE Mar 20 '14 at 08:53

3 Answers3

128

You can delete a remote tag the same way that you delete a remote branch.

git push origin :1.1

And delete your local tag with:

git tag -d 1.1
Abizern
  • 146,289
  • 39
  • 203
  • 257
  • 1
    I did: git tag -d 1.1 && git push origin :1.1 and that did the trick. Many thanks. – serby May 27 '11 at 12:10
  • 1
    Because remember, a branch IS a tag, just one that moves its HEAD along with the lastest commit that belongs to it. Internally, they're exactly the same. – Dan Ray May 27 '11 at 12:56
  • 3
    Actually - a lightweight tag is just like a branch. An annotated tag is an actual object, like a commit, that has a reference point to it. – Abizern May 27 '11 at 14:07
  • As of git version 2.7.4, if I try to delete the tag locally after the remote delete, I get error: tag '0.0.60' not found. I suppose it gets automatically deleted – Shadi Mar 23 '17 at 08:30
  • In case you need to delete _many_, _many_ tags, I figured out two ways to do this at least several magnitudes faster. The fastest is to include multiple `:tag` arguments to `git push`. The second uses the Github API to delete remote refs (tags) directly. (http://stackoverflow.com/a/43421561/657764) – TonyH Apr 15 '17 at 02:49
26
git push --delete origin TAGNAME

Of course, you still have to delete the tag locally by running:

git tag -d TAGNAME
Flimm
  • 136,138
  • 45
  • 251
  • 267
0

Simply, you can give the following command once you are in the local repository path (using cmd,code editor,IDE).

git push origin :your_tag_name_to_be_deleted
Niroshan Ratnayake
  • 3,433
  • 3
  • 20
  • 18