You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't create tag because one with the same name already exists, but the original can't be deleted #20344
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
@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.
Activity
tidy-dev commentedon Apr 14, 2025
@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.0After 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.