-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git for Win doesn't correctly handle branch names that differ only by case #1916
Comments
This is a known issue of Git being a Linux tool, ported to Windows. It becomes worse if one is also collaborating with *nix users who don't see the problems... If you have a look through the 'closed' issues there are a number of discussions about case sensitivity issues. At the moment there are no effective proposals that would fix the issues. If you are able to identify a possible solution to some aspect of the issue then that would help. |
The wiki page on these general issues is: |
I'd like an option in git to say "treat all branch names as lower-case in spite of what I typed" so that creating |
The problem comes when one is collaborating with others that are on a case sensitive system and then use CamelCase (or is that camelCase). If they created a It gets worse for UTF internationalisation and localisation (apparently the worst is the Turkish 'i'). That said, Pull Requests (PR) are always welcome, even if it's still in draft. The PR could even be just better signage in the upstream Git (which populates git-scm) and git-for-windows documentation! |
Good call. This needs to be larger than just windows-only set in an unsync'd folder. Perhaps a better proposal: a mechanism for validating branch names throughout a repository -- a pre-"branch" hook of sorts. So a tam can say "here's the regex for our branch names, and all branches must pass this regex to get created." |
Correct, one area that would need refactoring is the branch-name / pathname distinction that exists in the code paths. Often the branch-name is a distinct variable, different from the pathname (in the Git code), so it is not always possible to check, in the current code, if the case is different. Plus there is the need to interrogate the OS to determine its view of the file name (which can be slow if many paths need checking). Further, conceptually, branch names are just long strings. They are not truly paths, rather the fact that git uses them as if they are paths is just an implementation detail that POSIX handily supports (but the windows FS doesn't). It is a guddle! |
Possible solution: |
Not sure if this is the same issue, but this happened to me:
Then I renamed the folder to
This makes me unable to mark the files as renamed, I can only mark them as added.
I think it's worth mentioning explicitly that what can be case-insensitive is not exactly Windows, but NTFS, FAT, etc. So these case-sensitivity issues may be relevant for git for unix as well, since unix can mount these file systems (as case-insensitive) as well. |
@geekley : it is not the same issue. will tell Git about the rename. |
|
Thanks for reporting - I wasn't aware that the mv does not work for directories. Feel free to open a new issue, or (may be better) report it to upstream Git. |
Indeed, this would be the best idea: [email protected] |
Well, I'm lacking the time to test and write a proper bug report at the moment... I'm busy on a project, and it might take a while for me to be able to do it. |
No worries. If it is not that pressing a problem for you, it can safely wait until you have the time. No need to lean on other people for something you obviously do not need all that badly. |
Closing this as stale. |
Note: This feels like a problem with
git fetch
and/orgit remote prune ...
or with storing branches as folders. Feel free to 301 me to a better repository for this issue.Setup
64-bit Git version 2.19.1
defaults?
to the issue you're seeing?
Happens on other environments, OS's, Windows versions, and git versions.
Details
CMD
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Git could keep
branch/lowercase
andBRANCH/UPPERCASE
separatebranch/lowercase
becameBRANCH/lowercase
andBRANCH/UPPERCASE
becamebranch/UPPERCASE
because thebranch
folder already existed on machine 1, and theBRANCH
folder already existed on machine 2, and Windows is a case-insensitive file system.URL to that repository to help us with testing?
I've reproed this concern with a private VSTS repo, but any Git hosting should do. I have no URL that demonstrates this issue.
Note: Git also can't have branch names with non-windows characters (
<
,>
,:
,"
,/
,\
,|
,?
,*
) for the same reason, see also #1656 and https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-fileThe text was updated successfully, but these errors were encountered: