Web lists-archives.com

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

Am 09.04.2018 um 21:26 schrieb Hari Lubovac:
It appears to be just a reporting issue. Probably not a big deal, but
I thought I should report this, if it hasn't been noticed: when a
branch is switched to by being named with non-original
character-casing, then it's not clear which branch is current.


C:\repo>git branch
* bar

C:\repo>git checkout Bar
Switched to branch 'Bar'

C:\repo>git branch

The bug is not that the branch is not marked, but that you are permitted to check out a branch that does not exist. This is a side-effect of the fact that branch names are sometimes stored using file names, and, as we know, file names are case-insensitive on Windows. I don't know of any efforts to fix that (I assume that it is not just a simple fix). In the meantime, I can only recommend: if it hurts, don't do it.

If you call `git gc` before the checkout command, I would expect that you would not be able to check out branch 'Bar', because branches are represented unambiguously after 'gc' (not as file names).

-- Hannes