1

So i have two folders named "Folder1" and "folder1" in my git repository. But when i pull them onto IntelliJ For some reason it is merging both the folders into one named "IntelliJ".

For example:

if Folder1 has a file File1
and folder1 has a file File2
it creates a single Folder1 with both File1 and File2 in it.

I tried looking for the solution everywhere on the internet but it seems no one else ever encountered this problem before.

I am looking for a way so that this doesn't happen automatically.

Thanks in Advance. :)

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • 3
    What OS are you working on ? If it's Windows or MacOS : that's an issue with your filesystem, which isn't case sensitive. The only stable solution is to change folder names, so that they are different even when changing case. – LeGEC Jul 28 '21 at 07:31
  • I am using Macos – Rishabh Agrawal Jul 28 '21 at 07:51
  • yeah that would actually make sense, since the people for whom it is not merging are either using windows or linux – Rishabh Agrawal Jul 28 '21 at 07:52
  • 1
    Windows users will *generally* have the same problem. As a macOS user, you can set up a file system where you *will not* have this problem. See [my answer here](https://stackoverflow.com/a/59516454/1256452). – torek Jul 28 '21 at 08:11

1 Answers1

4

Your filesystem is case insensitive.

The issue you have is that git (which allows to have two names that differ only in uppercase/lowercase sitting one next to another), when trying to create two folders Folder1 and folder1 in your system and writing to those folders, ends up writing in the same single folder.

This issue should occur on MacOS and Windows stations.

Technically, this issue is linked to the filesystem (not the OS), so accessing a NTFS filesystem through a network share from a linux station, or a FAT32 filesystem on a thumbdrive, for example, would trigger a similar issue.


The stable "fix" is to make sure this situation (files or folders that only differ in letter case) doesn't happen in your repo.

Check the reason for the creation of these two folders (chances are a developper unwittingly committed a "wrong" version of the folder name from another case-insensitive system ...), and see if the correct fix is to :

  • merge the two folders together,
  • or find a more distinct name for one of the folders.
LeGEC
  • 46,477
  • 5
  • 57
  • 104