1

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.

Sithu
  • 4,752
  • 9
  • 64
  • 110

1 Answers1

1

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)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • If I rename my tag locally, e.g, **v1.0.0-RC1** to something else, will it really keep tagging the commit where it was? What I want to do is - (1) rename **v1.0.0-RC1** to **v1.0.0-tmp** (2) delete **v1.0.0-rc1** (3) rename **v1.0.0-tmp** to **v1.0.0-RC1** (4) `git push --tags`. Can I do it safely without breaking the current commit references for each tag ? – Sithu Dec 29 '14 at 14:20
  • Yes, a tag always reference the same commit when you rename it. – VonC Dec 29 '14 at 15:01
  • Unfortunately, tag name are case-insensitive in Windows git bash. `git tag -d v1.0.0-rc1` did delete `v1.0.0-RC1`. – Sithu Dec 30 '14 at 10:38
  • @Sithu ok, hence the suggestion to rename first. – VonC Dec 30 '14 at 10:55
  • @Sithu note that whatever is deleted by mistake would still be referenced in the `git reflog` (http://git-scm.com/docs/git-reflog), so restoring an improper delete remains easy and accurate. – VonC Dec 30 '14 at 10:56