Home > Back-end >  Git/Windows - Case sensitivity issues when checking out a branch (and pulling/merging a branch). Aff
Git/Windows - Case sensitivity issues when checking out a branch (and pulling/merging a branch). Aff

Time:10-28

Having a really strange issue with git and Windows regarding case sensitivity.

I am not a master at git but I'm also not a beginner. Just want to throw that out there.

Problem I am facing:

  • Clone a repository (don't specify branch, just grab what's on remote origin master)

  • Checkout an existing dev branch (let's call it DEV)

  • A number of files are now all lowercase

    a. Both branches have the same casing for these files

    b. The affected files seem to be the ones that contain content differences between the two branches

    c. Not all files are affected

Additional notes:

  • Using a Windows system (which is case-insensitive)

  • git config file defines ignorecase = true

    a. Tried switching to false, did not eliminate this issue

  • Tried running ls-tree on each branch, both show the files as having the same case (not all lowercase)

  • When switching to Dev branch and back to master, the affected filenames remain lowercase

  • Cloning the Dev branch directly works fine. Does not result in these lowercase filenames

I've tried a number of things to solve this problem, albeit no solution as of yet.

Does anybody have any clue what may be going on here? I'm not finding much support regarding this issue.

This question looks to be related (but has no answer):

Switching GIT Branches randomly changes filename case

Thanks

CodePudding user response:

There may be someone who can figure out exactly what is happening and why, however I'm afraid most the the experience folks who answer this will offer something along the lines of "if it hurts, don't do it".

Case in point, torek suggested getting a Linux system in a comment. Torek is one of the most experienced folks on stackoverflow and if they don't have an answer for you the odds are that it is not coming.

If you don't want to get a Linux system, another option is to change the case on all files to be the same (e.g. all lower case).

People often advise folks to not mix the case in filenames for this reason. I personally prefer all lower case.

CodePudding user response:

Enable case sensitivity on the folder in Windows. (NTFS has this feature since April 2018.)

fsutil file setCaseSensitiveInfo <folder> enable

See https://docs.microsoft.com/en-us/windows/wsl/case-sensitivity

  • Related