Fixing case sensitivity issues with filenames in Git
NicolasBrondinBernard
Passed a filename in lowercase (or vice versa) and git doesn't detect it? Here's the solution!

Article published on 23/02/2021, last updated on 10/08/2026
Windows and MacOS are operating systems that are described as case-insensitive, which means that file and folder names are treated the same way whether they are written in uppercase or lowercase.
Note that just because the OS is case-insensitive doesn't mean that the software running on it is too.
Normally this feature is supposed to make life easier for users, who don't have to worry about this detail, but when you use certain tools like Git, it can cause you problems.
Let's imagine you renamed a file LOGO.jpg to logo.jpg and you changed the file path in your application, whatever it may be, then everything will be fine, until you want to version your changes.
If the file renaming was the only operation performed, at the time of the commit git will return the message "nothing to commit".
Indeed, Git will properly take into account the changes inside your files, but it will not detect the case change in the name of your logo.jpg file
Your local version will work correctly, but if someone else pulls your version, the path contained in your application and the actual file path will not be the same (different case).
So the question is: How do I get Git to detect the case change in my file name?
The solution is very simple, and fits in a single command line:
$ git mv LOGO.jpg logo.jpg
The git mv command allows you to move or rename a file.
This way you explicitly tell the version manager that the file has been renamed, so it will detect the modification and the latter can be added to the next commit!
Complete courses, exercises and certificates to really learn programming!
4.8 average rating
No comments yet