DEV Community

Prayatna Bhattarai for Student Edge

Posted on

Rename folder to lowercase - Git

We are always having issues renaming a folder to lower case because git does not tend to understand the difference even if we change the folder.

The way we would rename is:

First move the folder to another temp. folder

git mv src/Home src/homes
Enter fullscreen mode Exit fullscreen mode

Then move the folder to the desired folder name:

git mv src/homes src/home
Enter fullscreen mode Exit fullscreen mode

Finally commit the change

git commit -m "rename folder from Home to home
Enter fullscreen mode Exit fullscreen mode

If you are running windows, the rename may not reflect on the windows explorer so we follow similar approach. -> rename to temp folder and rename it back again

Rename-Item Home homes
Enter fullscreen mode Exit fullscreen mode

commit the changes and again run

Rename-Item homes home
Enter fullscreen mode Exit fullscreen mode

and finally push your changes.

We run webpack so sometimes it caches the build so have to run a build for prod and then again switch back to the local dev build.

Top comments (4)

Collapse
 
marksyzm profile image
Mark Elphinstone-Hoadley

I've been using this:

git config core.ignorecase false
Enter fullscreen mode Exit fullscreen mode

Sorry, I know this is late to the conversation!

Collapse
 
doomsweb profile image
Timo Semmler

Thanks!

Collapse
 
osadavc profile image
Osada Vidath

Thank You So much

Collapse
 
ggsingla profile image
Gautam Singla • Edited

I was struck with an issue due to this exact thing, thanks for writing this article 🙌