I'm working with git on windows, and I have a file in my repo, lets say "foo.txt".
Today I wanted to rename this file to "Foo.txt" (uppercase). As suggested in this SO question, I used git mv -f foo.txt Foo.txt
, which produced the desired result. I proceeded to commit the change to my repo.
EDIT: I would like this to be a permanent change, and still be able to checkout commit that predate this change.
However, after that I encountered an error upon trying to switch branch:
# I'm on branch1
git checkout branch2
Aborting
error: The following untracked working tree files would be overwritten by checkout:
Foo.txt
Please move or remove them before you can switch branches.
After some poking around I found that my .git/config
file had the following setting:
[core]
ignorecase=false
Changing this to true seems to fix the issue and allows me to change between branches as normal.
So regarding this, I would like to know:
- Is there any adverse effect of this setting? Should it always be true on windows? What if I'm working with other dev's and they don't have the same value set for this?
- Is there another way to rename the file without having to change this setting?
- Why does this happen in the first place? When I committed the change, git correctly identified that the file was in fact renamed (didn't delete one file and then add another). So what exactly happened when I tried to switch branches?
Thanks!