Git status shows file twice but different case

git, git-extensions, windows

Solution

This can happen in Windows if you have a repo with `ignorecase = false` and rename a file without using git. To fix, this should work

git mv -f Resource.h resource.h
git commit -m 'fix case'

and this should prevent it from happening again.

git config core.ignorecase true

Problem

I tried to do a search for my issue and the closest thing that I could is this. git Status Shows Same File Twice - But with different path slash styles But it doesn't seem to be the same issue I have. I was doing a commit and noticed that the same file was listed twice but with different case. For instance, `Directory/resource.h` and `Directory/Resource.h`. Now there is only one file in the directory `resource.h`. If I look at the file through Git Extensions they look exactly the same. There doesn't seem to be another hidden file, there is only one file. So I tried to fix this by removing the `resource.h` file, committing, and then adding the file back and recommit again. Only one file showed up as added. I thought I fixed the issue, but now if I try to checkout a different branch I get the following error. ``` error: The following untracked working tree files would be overwritten by checkout: Directory/Resource.h Please move or remove them before you can switch branches. Aborting Done ``` I don't really have any idea what to do from here, I've only been using Git for a few months and I haven't had to do anything more complicated than merging branches and pushing and pulling.

Original source

Related problems