Why does Visual Studio 2019 change the case of some letters in a branch I created in ADO?

Viewed 44

I created a branch in Azure DevOps (ADO) with all lower case letters: alwayson/user/jr/870397. I then went to Visual Studio 2019 and did a Fetch in Team Explorer. In Team Explorer, I then filtered branches on "870397". What Visual Studio showed was a branch on the remote where the 'a' and the 'o' had been changed to upper-case: AlwaysOn/user/jr/870397.

Why does VS do this case changing, and is there a way to prevent it from doing so? I couldn't find a setting or related property anywhere in VS.

1 Answers

Azure itself should not change anything.

Its documentation even includes:

Branch and tag names

You can create two branches or tags (known as 'refs') that differ only in casing.
Git's internals, as well as Azure DevOps Services/TFS, will treat them as two separate refs. On a user's machine, Git uses the filesystem to store refs.

Fetches and other operations begin to fail because of the ambiguity. Each ref is represented by a small file, and if a ref name contains / characters, the parts before the final / are represented by folders.

One simple way to avoid issues is to always use all-lowercase branch and tag names. If you have already created two branches or tags with this problem, you can fix it in the Azure Repos web UI.

So double-check the full list of branches with git branch -avv locally to see what you have fetched.

Related