Git and The Hell of Case Sensitivity
CASING is ImPoRtAnT. Especially in git, where using the incorrect casing could become a real source of irritation to developers.
Join the DZone community and get the full member experience.
Join For Freeif you know how git works, you are perfectly aware that, even if you work in operating systems with a case insensitive file system, all commits are case sensitive. sometimes if you change the case of a folder, then commit modifications of files inside that folder, you will run into problems because if the casing of the path changes, the files are different for the git engine (but not for operating systems like windows).
in the long run, you will face some annoying problems, like git showing that some of the files are modified (while you didn’t touch them) and being unable to undo changes or work with those files. this problem will become really annoying during rebase operations.
having files with only case differences is one of the most annoying problem with git repositories in windows.
luckily enough, azure devops has an option for git repository where you can have the engine prevent commits that contains file names with only case differences, to avoid this problem entirely.
figure 1: options for cross-platform compatibility can solve most headaches
the first option completely blocks pushes that contains files not compatible across platforms and is the option that we are looking for because it will block you from pushing code that will lead to case sensitiveness problems.
the other two options are equally necessary because the second one will prevent you from pushing a path with forbidden names or incompatible characters (remember that this is different between windows and linux). finally, the third one will block pushes that contains a path with unsupported length, a problem that is really nasty for windows users.
in the end, if you have a case sensitivity problem in your repository and you already pushed your code, because you did not have these options enabled, i can suggest you try a nice tool available in github that finds all problems in the repository and fixes them called git unite . you can clone the project, compile it in visual studio, then just launch from command line giving the path of a local git repository as single arguments and it will do everything automatically.
Opinions expressed by DZone contributors are their own.
Comments