Skip to content

Tag thats deleted in GitHub isn't deleted in GitHub Desktop after fetching #9946

Closed

Description

@CraigMusser

Describe the feature or problem you’d like to solve

A clear and concise description of what the feature or problem is.

Proposed solution

How will it benefit Desktop and its users?

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

Activity

  1. CraigMusser commented on Jun 5, 2020

    @CraigMusser
    Author

    I created a tag in a repository and then pulled that tag down to GitHub Desktop v2.5.2. The tag then shows on the commit in the repo history. I delete the tag from GitHub and then pull from remote to local in GitHub Desktop. The tag remains on the same commit in GH Desktop.

  2. niik commented on Jun 5, 2020

    @niik
    Member

    Hi @CraigMusser, thanks for opening this, sorry for the inconvenience!

    Not deleting or updating local tags on fetch or pull is the intended behavior of Git. Conceptually a tag is an immutable object that is never supposed to change.

    The git tag man page has a great section on this if you're curious.

    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 manually delete the tag locally by running git tag -d TAGNAME.

    As this has to do with underlying conceptual semantics there's not much GitHub Desktop can do different here so I'm going to close this out.

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