Home > Mobile >  Can't change case of tag "folder" name git
Can't change case of tag "folder" name git

Time:12-07

I have the following tags:

release/1.0
release/2.0
release/2.2.5
Release/2.5.0
Release/3.0.0

I want to get the casing to match on release. So for example, release/2.5.0 instead of Release/2.5.0.

So I run the following sequence of commands:

git tag release/2.5.0 Release/2.5.0
git -d Release/2.5.0

However, I end up with (in the above case) release/2.5.0 being deleted entirely.
I figured that it might be having trouble with the casing (with that being the only difference between the names), so after fetching the tag from my remote, I tried the following:

git tag r/2.5.0 Release/2.5.0
git tag -d Release/2.5.0
git tag release/2.5.0 r/2.5.0

After this, I have the following tags:

r/2.5.0
release/1.0
release/2.0
release/2.2.5
Release/2.5.0
Release/3.0.0

So it forced the case of Release back to the original upper case. I assume a reference being stored somewhere, but I don't know the best way to deal with this.

FWIW: I tried this originally from cmder console emulator on Windows and on ubuntu in WSL. And I tried it in my git GUI client (fork). The result was the same everywhere.

It's not really a huge deal, but it's a lot less clean, particularly in the git gui when I have two folders dividing my tags between them.

CodePudding user response:

(On this machine I'm using git for windows 2.24.1)

Since lightweight tags are files/folders in .git/refs/tags i cannot have tags with mixed lower/upper case. Example:

zrrbite@ZRRBITE MINGW64 /d/dev/git/test
$ git tag Release/1.0.0

zrrbite@ZRRBITE MINGW64 /d/dev/git/test
$ git tag
Release/1.0.0

zrrbite@ZRRBITE MINGW64 /d/dev/git/test
$ git tag release/2.0

zrrbite@ZRRBITE MINGW64 /d/dev/git/test
$ git tag
Release/1.0.0
Release/2.0

I started off by creating Release/1.0.0. Subsequently, if i create release/2.0 (lower case 'r'), it gets put in the Release/ folder in refs/tags, despite being created as a lower case tag.

Since these are lightweight tags, manipulating the .git folder should be safe. Just modify the names of the files and folders to your liking. E.g., after renaming refs/tags/Release to refs/tags/release i now get lower case tags:

zrrbite@ZRRBITE MINGW64 /d/dev/git/test (old)
$ git tag
release/1.0.0
release/2.0
  • Related