I'm managing a repo of a Unity Project. We have three devs working on separate branches. One of the Asset folders for Prefabs files has a weird issue where we are unable to discard a file from the charges before commit or merge.
Before "Discard"
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Assets/prefabs/TrackSpheres.prefab
no changes added to commit (use "git add" and/or "git commit -a")
After discarding the file, it will reappear with another version but with a different capitalized folder (Correct version as in the local directory). The file is an older version that can be disregarded. Shown below:
After "Discard"
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Assets/Prefabs/TrackSpheres.prefab
no changes added to commit (use "git add" and/or "git commit -a")
I'm also unable to checkout other branches due to the following files would be overwritten which I'm fine with.
I have tried git config core.ignorecase false
, Reset, Clear cache.
I have tried
git config core.ignorecase false
You need to try git config core.ignorecase true
, otherwise, after modifying Prefabs/TrackSpheres.prefab
, you can add the same file with a different case path:
git add prefabs/TrackSpheres.prefab
, the status is:
new file: prefabs/TrackSpheres.prefab
modified: Prefabs/TrackSpheres.prefab
If you commit this modification and then modify this file again later, you will be able to see two modification records:
modified: prefabs/TrackSpheres.prefab
modified: Prefabs/TrackSpheres.prefab
If you restore this file using git restore Prefabs/TrackSpheres.prefab
at this point, only the first record will remain, this is the initial state of your question.
modified: prefabs/TrackSpheres.prefab
After that, you restore prefabs/TrackSpheres.prefab
, but for git, the previously restored file on the Prefabs/TrackSpheres.prefab
path has been modified again, so that modification record appears again.
If you don't need that lowercase path, you can just remove it
git rm prefabs/TrackSpheres.prefab --cached