Sithu
Sithu

Reputation: 4862

How to delete the mistakenly case-changed renamed tag in github?

I had a tag v1.0.0-RC1 in my Github repo. I wanted to rename it to all lowercase like v1.0.0-rc1. So, I did it from the release edit page https://github.com/username/repo/releases/edit/v1.0.0-RC1. I found that it created a new tag v1.0.0-rc1 and it made me having two duplicate tags v1.0.0-RC1 and v1.0.0-rc1 in my repo.

The following is how my Github tags page is showing the latest 5 tags. The latest tag is v1.1.0-rc. The second v1.1.0-rc1 is my mistaken tag. The last tag is the one I wanted to rename.

v1.1.0-rc …
 84da1ca   zip   tar.gz   Notes   Downloads

v1.0.0-rc1 …
Merge branch 'minor'
 2823515   zip   tar.gz

v1.1.0-beta …
 94d9821   zip   tar.gz   Notes   Downloads

v1.0.0 …
 0c052f5   zip   tar.gz   Notes   Downloads

v1.0.0-RC1 …
 1955b7a   zip   tar.gz   Notes   Downloads

Here is the result of git fetch.

$ git fetch --all
Fetching origin
From https://github.com/username/repo
 * [new tag]         v1.0.0-rc1 -> v1.0.0-rc1
 * [new tag]         v1.1.0-rc  -> v1.1.0-rc
From https://github.com/username/repo
 * [new tag]         v1.0.0-RC1 -> v1.0.0-RC1

I want to delete v1.0.0-rc1. I know how to delete a remote tag.

git tag -d v1.0.0-rc1
git push origin :refs/tags/v1.0.0-rc1

But I'm afraid that it could delete the both tag rc1 and RC1. How can I achieve this safely? I'm using Git for Windows and it's likely to be case-insensitive.

Upvotes: 1

Views: 90

Answers (1)

VonC
VonC

Reputation: 1327184

But I'm afraid that it could delete the both tag rc1 and RC1.

It shouldn't: tags are case-sensitive.

How can I achieve this safely?

You could rename your tag locally before deleting it, if you really want to be on the safe side (and using a case insensitive OS).
You don't need to do the same on the GitHub side (which does respect the case)

Upvotes: 1

Related Questions