Skip to content

Tag can't be deleted #9938

Closed
Closed

Description

@sraillard

Describe the bug

A tag can't be deleted (tags are listed and can be added)

Version & OS

Version 2.5.2 on Windows 10

Steps to reproduce the behavior

  1. Add a tag
  2. Push to origin
  3. Try to delete the tag

Expected behavior

The delete tag option shouldn't be greyed

Actual behavior

The delete tag option is greyed

Screenshots

image

Activity

  1. niik commented on Jun 4, 2020

    @niik
    Member

    Hi @sraillard, thanks for opening this and sorry for the inconvenience!

    GitHub Desktop doesn't support deleting tags that have already been pushed to the remote.

    You're only able to delete a local tag up to the point when you push it. Deleting pushed tags is a much more complicated affair than one might think and this has to do with how Git itself is designed.

    If you're curious about the technical details as to why Desktop won't let you delete a pushed tag the git tag man page has a great section on this.

    On Re-tagging

    What should you do when you tag a wrong commit and you would want to re-tag?

    If you never pushed anything out, just re-tag it. Use "-f" to replace the old one. And you’re done.

    But if you have pushed things out (or others could just read your repository directly), then others will have already seen the old tag. In that case you can do one of two things:

    The sane thing. Just admit you screwed up, and use a different name. Others have already seen one tag-name, and if you keep the same name, you may be in the situation that two people both have "version X", but they actually have different "X"'s. So just call it "X.1" and be done with it.

    The insane thing. You really want to call the new version "X" too, even though others have already seen the old one. So just use git tag -f again, as if you hadn’t already published the old one.

    However, Git does not (and it should not) change tags behind users back. So if somebody already got the old tag, doing a git pull on your tree shouldn’t just make them overwrite the old one.

    If somebody got a release tag from you, you cannot just change the tag for them by updating your own one. This is a big security issue, in that people MUST be able to trust their tag-names. If you really want to do the insane thing, you need to just fess up to it, and tell people that you messed up. You can do that by making a very public announcement saying:

    Ok, I messed up, and I pushed out an earlier version tagged as X. I
    then fixed something, and retagged the *fixed* tree as X again.
    
    If you got the wrong tag, and want the new one, please delete
    the old one and fetch the new one by doing:
    
    	git tag -d X
    	git fetch origin tag X
    
    to get my updated tag.
    
    You can test which tag you have by doing
    
    	git rev-parse X
    
    which should return 0123456789abcdef.. if you have the new version.
    
    Sorry for the inconvenience.
    

    Does this seem a bit complicated? It should be. There is no way that it would be correct to just "fix" it automatically. People need to know that their tags might have been changed.

    If you're certain that you're the only one using the repository or that no one else has fetched your tag yet you can follow the instructions in the man page to manually delete the tag on the remote.

  2. sraillard commented on Jun 4, 2020

    @sraillard
    Author

    Hi @niik, I have read and understand the point regarding moving the tags.
    But, in CLI, I can do it. I think it's a kind of opiniated choice to not allow it.
    Users are reponsible for what they do, having a warning is nice, preventing the action is not.
    Sebastien

  3. EmeraldNova commented on Dec 25, 2020

    @EmeraldNova

    What kind of backwards logic is this? Let us do what we want with our repositories. We should be able to delete remote tags if we want.

  4. nerdCopter commented on May 4, 2021

    @nerdCopter

    Screenshot_2021-05-04_08-57-54

    [...] Deleting pushed tags is a much more complicated affair than one might think and this has to do with how Git itself is designed.
    [...]

    seemingly easy if CLI can do:

    git checkout [master|branch|commit]
    git tag testTag
    git push [origin|upstream] testTag
    git tag --delete testTag   #delete local tag
    git push --delete [origin|upstream] testTag   #delete remote tag
    
  5. montao commented on May 7, 2021

    @montao

    Did it ever occur to anyone here that "Simple things should be simple" ...?

  6. crispy-computing-machine commented on Nov 12, 2021

    @crispy-computing-machine

    git tag -l | xargs git tag -d && git fetch -t

  7. JokerDen commented on Jan 20, 2022

    @JokerDen

    Still sad that GitHub Desktop can't delete pushed tags. SourceTree has no problem with that.

  8. fabiocaccamo commented on Apr 19, 2022

    @fabiocaccamo

    It's a shame you don't want to add this feature, personally I think that since it can be done using the CLI, that's a good enough reason to implement it as a right-click context menu option on tagged commits.

    Regarding the possible drawbacks, users are responsible for what they do with their own repositories.

    Before I was able to do it with Source Tree, GitHub Desktop is much more better but now I have to do this:

    git tag -d 0.1.0
    git push origin :0.1.0
  9. ThreeDeeJay commented on Jun 7, 2022

    @ThreeDeeJay
  10. simulatedScience commented on Aug 11, 2022

    @simulatedScience

    when viewing your repository online on github.com, there is a button for deleting a tag. Seems to work perfectly. Why is this button not available in github Desktop?

  11. thomasfw commented on Aug 27, 2023

    @thomasfw

    Pretty absurd. Surely it would be more appropriate to allow tag deletion but also show a warning message to the user, as has already been suggested?

  12. bvdwalt commented on Nov 23, 2023

    @bvdwalt

    I also just ran into this issue, would be helpful to be able to do it all in GitHub Desktop. What is the point if I can create tags but then have to keep the commands handy to delete them.

  13. drawcode commented on Dec 5, 2023

    @drawcode

    Maybe put the warning about local/remote tags in a dialog or warning, then let the people add/remove tags with freedom and all that brings?

    A workflow that is annoying: When someone deletes a tag on github and then local fetch/sync is performed, it doesn't always remove them locally. So you have to then run the CLI locally to remove. Even when working alone on a repo this is annoying.

    Basically, at minimum, if a tag is removed on github it should also auto delete it on the local repo when fetch/synced/pulled.

  14. PenguinPofi commented on Feb 1, 2024

    @PenguinPofi

    Absolutely asinine.

    Ran into this today. Deleted the tag on remote. I know for a fact no one has the wrong tag. But I can't remove the existing one locally.

    Not only can I not remove the existing one locally - I can't re-use it on another commit, because "tag already exists". Except it really doesn't. Amazing. No other user has it, remote doesn't have it either. It's just me, locally, unable to delete my own local tag.

    My tag mislabeling is not insanity.
    Your UI is decision-making is insanity.

  15. DenisK-Voodoo commented on Feb 1, 2024

    @DenisK-Voodoo

    @PenguinPofi and what if other user push this tag? 🤔
    Will you be able to pull it?

  16. PenguinPofi commented on Feb 1, 2024

    @PenguinPofi

    @DenisK-Voodoo No idea. As fun as that test sounds - I just switched over to sourcetree and deleted my tag there.

  17. wpadykulaggs commented on Nov 27, 2024

    @wpadykulaggs

    when viewing your repository online on github.com, there is a button for deleting a tag. Seems to work perfectly. Why is this button not available in github Desktop?

    This actually allows a dumb but functional workaround - delete the tag online, then locally delete your whole repository and clone it again - since online you were able to delete the tag no problem, when you clone the repository back from remote, it won't have the tag any longer.

  18. Arthmoor commented on Dec 11, 2024

    @Arthmoor

    I think this is kind of silly. You can delete tags from the GitHub UI in your web browser and that's accurately reflected in the repository there. You can then reuse that same tag in a different place from the GitHub UI and the repository honors that as well.

    This means your local copy in your desktop app will now be incorrect because fetching from origin won't update where that tag ended up. I think that's actually much worse than simply not allowing the local deletion.

    The desktop app should support you doing anything you can do from the GitHub site.

  19. nmdias commented on Feb 2, 2025

    @nmdias

    This logic is unnecessarily convoluted for such a simple but useful feature.

  20. Doodys commented on Sep 17, 2025

    @Doodys

    2025 and we still cannot remove pushed tags. SourceTree can do this, TortoiseGit can do this, I bet many other apps can do this. The best one (imho) cannot, smh

  21. HGjuanh commented on Feb 10, 2026

    @HGjuanh

    2026 and we still the same...

  22. ElderLich commented on Apr 9, 2026

    @ElderLich

    Crazy...

  23. OmegaHawkeye commented on Jul 9, 2026

    @OmegaHawkeye

    6 months into 2026 and my PR got closed bc it doesn't solve a needed issue.

    Tbf I forgot to mention the issue immediately when creating the PR (#22482) and I didn't even know of this specific issue.

    Just wanted the same functionality as SourceTree but inside the better App

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions