Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case sensitivity with file names in VS Code and Windows Git

I'm having an issue with VS Code v1.26.1 on Windows 10. I cloned a repository where, in the same directory, it has file names with the same name but different cases for example: filename.ext and FileName.ext.

VS Code thinks that these are the same file with a change, therefore it is showing them in the Source Control, but when I discard the changes it just changes the names back to the other case + it won't stash or stage them.

I have tried the git config core.ignorecase false and git config --global core.ignorecase false commands but it doesn't seem to do anything. I also tried changing it to true and back to false.

Anyone had/having this issue and found a work around for this?

PS: I cannot change the file names to something else. These file names MUST stay the same.

like image 400
Christina Ellul Avatar asked May 26 '26 00:05

Christina Ellul


2 Answers

Late answer, but Git and Case Sensitivity solved the problem for me.

My project wouldn't compile because it was looking for app.js instead of the file's actual name App.js. I renamed the file in VSCode and the project compiled. However, after every commit, App.js reverted to app.js.

To force git to detect the change I used git-mv.

git mv app App

According to the post author:

The tracked file or folder you want to recapitalize has to be explicitly renamed using a Git command. git mv works the same as mv, except it informs Git that a file or folder has been renamed by immediately staging the change.

like image 55
It'sNotMe Avatar answered May 27 '26 12:05

It'sNotMe


The 2 steps rename works fine for me.

git mv OriginalFolder tempfolder
git mv tempfolder originalfolder
git commit -m "renamed folder to lowercase"
like image 31
Naresh Nagpal Avatar answered May 27 '26 13:05

Naresh Nagpal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!