Skip to content

Can't create tag because one with the same name already exists, but the original can't be deleted #20344

Closed

Description

@Bestsoft101

The problem

I have now encountered this issue multiple times: I wanted to make a commit, but before pushing I realised that I did something wrong, so I undid the commit, fixed the problem, and then was unable to add a tag because one with the same name apparently exists already

Release version

Version 3.4.18 (x64)

Operating system

Windows 10

Steps to reproduce the behavior

Create a new repository
Do something in the repository, and Commit to main
Add a tag with the name 1.0 to the commit
Right click the commit and select Undo commit
Commit to main again
It is no longer possible to create a tag with the name 1.0 on any commit

Log files

No response

Screenshots

Can't create tag even though it's not there

Image

Additional context

No response

Activity

  1. added
    triage
    on Apr 14, 2025
  2. tidy-dev commented on Apr 14, 2025

    @tidy-dev
    Contributor

    @Bestsoft101 Thanks for reaching out. Unfortunately, the tag does still exist in git. When you first did the commit, the commit got a sha and when you applied the tag. It is related to that sha. Then, when you undid the commit and recommitted. The commit got a new sha. The tag remained on the old commit sha.

    So, in git the tag does exist, just no longer in your branches history. Unfortunately, there isn't a way to get to it in GitHub Desktop. Thus, you need to delete the tag using the command line interface.

    git tag --delete 1.0

    After that you will be able to create the tag in GitHub Desktop.

    To prevent this in the future, you could delete the tag first or amend the commit instead of undoing.

    Other notes:
    This is easily reproducible and could be considered a bug. But, I am going to close in favor of including feedback on the ability to search tags, such that it is considered in that solution.

  3. removed
    triage
    on Apr 14, 2025
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