I've run into a problem with git. Basically I set to false core.ignorecase
because I wanted to change the case of the names of some folders (since I'm under OSX with a case-insensitive filesystem, the changes weren't shown otherwise). When I pulled my data, I've noticed that now every renamed folder appears twice on the repository, with both the old and the new name. I don't know what to do to remove the old folders since they don't appear locally (I've try to set core.ignorecase
to true again but it isn't helping).
-
1Maybe you could create a ext3 filesystem over a image, mount it, and pull in this case-sensitive filesystem. – André Puel Jan 18 '12 at 02:17
-
@AndréPuel well, actually I was looking for something ‘easier’. :P but thanks for the advice, I'll go for it if I don't find other solutions. – entropid Jan 18 '12 at 02:21
6 Answers
May be a workaround similar to this comment in an msysgit issue (for another case-insensitive OS: Windows) could help?
I've encountered this same issue. Refactored a package name in Eclipse and switching to a previous build broke due to the folder name not reverting. I'm using Windows 7, Git 1.7.0.2.msysgit.0
My folder was renamed in Windows to "
folder
" but was displayed as "Folder
" in Git.
I fixed the issue by renaming it to "Folder
" in Windows and then running:
git mv "Folder" "Folder2"
git mv "Folder2" "folder"
Note that since git 2.0.1 (June 2014), git mv Folder folder
should just work!
-
1I noticed that when renaming in this way, the second rename can take a *looooong* time. The answer is to be patient; the folder will eventually rename, then you can commit it. – NathanAldenSr Jan 07 '14 at 01:13
-
Another way to get the same is renaming "Folder" to "Folder2" and make a commit and then "Folder2" to "folder" and amend the last commit. – DaniCE Mar 27 '15 at 03:10
-
@DaniCE I have just edited the answer: with git 2.0.1 this should be much simpler. – VonC Mar 27 '15 at 06:43
Use the following command on macOS. This will change your git configuration to be case sensitive on filenames.
git config core.ignorecase false
You can set this globally by editing ~/.gitconfig
and setting it under core
such as:
[core]
ignoreCase = false

- 3,627
- 2
- 32
- 60

- 2,380
- 1
- 15
- 6
-
2I did exactly the opposite in order to make git succeed doing a rebase that included a case rename. Thanks! – sorin Oct 18 '18 at 09:16
-
This option is not to tell git to be case-sensitive, instead it is to make git compatible with the filesystem if is misconfigured. – Amin Jul 02 '23 at 08:28
You can create a disk image (preferably a sparsebundle disk image) with a case-sensitive file system and checkout your git repository there.
The Disk Utility screenshot below shows how to create a case-sensitive disk image.

- 8,285
- 6
- 52
- 91
-
A much better, permanent, solution to this problem and other mysteries resulting from case sensitivity. I made the disk image; copied my old Git repos into it; made a symbolic link from where I used to keep all my git repos to the new, sparse bundle version. Back to normal workflow never to encounter this again. – jwd630 Dec 21 '15 at 15:20
-
1
-
1@MinqiPan, I had the same concern, but it shouldn't be if you create an APFS volume. [APFS volumes can exist in the same "container" partition](https://en.wikipedia.org/wiki/Apple_File_System#Space_sharing), thus having no performance penalty. – Victor Sergienko Apr 15 '19 at 18:53
Mac OS X by default is "case insensitive but case preserving". This is an important distinction.
I suggest you create another disk image, and specifically format it as "HFS Case Sensitive".

- 11,517
- 1
- 40
- 72
-
-
8Unfortunately a lot of bad software (Adobe, of course) relies on the default broken OSX filesystem. Be wary. – Jim Stewart Jul 25 '13 at 15:56
git mv "Folder" "Folder2"
git mv "Folder2" "folder"
git commit -a -m "my message"

- 11,835
- 15
- 54
- 71

- 622
- 7
- 10
There is a longish recent thread on case sensitivity issues on the git@vger.kernel.org discussion forum titled Bug? Git checkout fails with a wrong error message which highlights the issues, and things to try, of case sensitivity between different platforms.

- 13,333
- 9
- 48
- 71