Reputation:
Why is github showing duplicated files but on my local machine it doesn't show that. I checked by pulling from my main branch in my local machine but it shows that its 'Already up to date.' How do i fix this? The lower case files in my github are old files
Upvotes: 0
Views: 89
Reputation: 487993
Don't set or clear core.ignorecase
manually:1 that's just lying to Git. Git sets this value based on how your computer behaves, by performing a relatively time consuming test at git init
or git clone
time.
Later, Git reads the value to see how your computer will behave as it creates and deletes various files. It then assumes that your computer will and did behave the way the value says. If your computer actually behaves differently, you can get yourself into trouble.
Given that you are on a Mac, the way to fix this is to create a case-sensitive file system, clone the repository there, fix it there, commit, and push the new commit back to GitHub. The fixed-up commits will have whatever files with whatever case you set up. You can then fetch those commits into the copy of the repository on the other, case-insensitive-but-preserving, file system.
In other words, you just create a new virtual disk (see this answer), format it, and make a new (but temporary) repository there where you can work in a case-sensitive manner. Once you're done with this work and have pushed the commits back, you won't need the virtual disk any more (but you can keep it around: I keep one around on mine).
1There are some very special corner cases where, knowing how Git is using core.ignorecase
internally, you can set it "wrong" to accomplish something, then fix it again. But it's better to just leave it alone, really. The only time you should set it is if you've changed your computer's behavior—e.g., if you had a backup that included a .git
repository on computer A running OS #1, and you've now switched to computer B running OS #2 and restored the backup. If OS #2 behaves differently, now it's time to change core.ignorecase
.
Upvotes: 5