Working in git with directories with the same name but with a different case on Windows

I want to extract from a git repository on Windows that has two directories named Foo and Foo . Both folders have different contents.

Since Windows is case insensitive and does not allow folders with the same name, but in another case, how can I click on git repo?

+5
source share
2 answers

Short answer: you cannot.

Since this is a limitation of the base file system (NTFS), not just Windows, you cannot really do much. The file system is no different between different cases; therefore, even if Git is able to track differences, it cannot transfer these differences to the file system.

What you could do is create partial commits where you simply add files to the correct folder (you need to rename it between them to get a different shell). But it will be very impractical.

The best solution is simply not to use multiple folders with a conflicting name. Even with case-sensitive file systems, this will only make things more confusing.

+5
source

As a subsequent answer to the call, you need to split these directories into different names or merge them correctly into the same name with the same name, depending on your needs, of course. They cannot have the same name in another case and work on Windows (in an explicit and obvious way).

I accidentally got into the same boat. I'm not sure how, when I used Windows all the time, but at some point I changed the case in the directory in the repo, and some files ended up in the directory with the old name, and some in the same with the "new" name. On my Windows machine, they were all under a new name, but I found this problem when I pulled out the repo on Linux and confirmed the split when I looked in my Assembla repository.

To fix this, I first cloned it to a separate location on my Windows machine. Thus, all the files were again in the same directory, since, apparently, the two directories are simply merged. Then I renamed this problem directory to "temp" (using the "rename" TortoiseGit operation). Then I cloned the repo to another place. At this point, the two directories were separated on Windows. I had "temp", plus a directory with the old name.

As I really wanted them in the same directory (on all platforms!), I moved the files from the old named directory to "temp" and then deleted the "old" directory. Then I renamed temp (again using the β€œrename” TortoiseGit operation) to the name in which I wanted everything inside, earned and clicked again. Finally, I put the changes into my original repo, my linux-one, and looked at Assemble. Everything was finally in agreement, so I deleted these temporary clones and called it day.

+1
source

Source: https://habr.com/ru/post/1210287/


All Articles