How to change a file name's capitalization without changing its content?

If you have a Windows setup, you must have faced the annoying issue of file name case change. Where you changed the file name capitalization, but it just doesn't show up.

Working with a team of various backgrounds is always tricky; everyone has their way of doing things, standards, preferences, and styles. One of these preferences is the way we name our files. People do it in several ways; for me, it's always kebab-case, but some of my colleagues like to call it snake_case, and others do it in camelCase.

When writing a standard code, it's always essential to keep the conventions similar for a cleaner code, and for that, we have to change each other file names according to the one set as default for that particular project.

Doing so in your local file system is pretty straightforward, but git is case-insensitive and does not recognize the changes made in the file name if you have not changed any letter. So as long as you are changing to an entirely different style, that is, kebab-case to camelCase, you should be fine, but if you are only changing the capitalization, you are fucked. To do this, you need to run the following command:

git mv --force myfile MyFile

Originally Posted On: Github (k88hudson)

Subscribe to GIT.WTF!?!

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe