Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case sensitivity in Git

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).

like image 509
entropid Avatar asked Jan 18 '12 02:01

entropid


People also ask

Are git files case-sensitive?

The Windows and macOS file systems are case-insensitive (but case-preserving) by default. Most Linux filesystems are case-sensitive. Git was built originally to be the Linux kernel's version control system, so unsurprisingly, it's case-sensitive.

Is git case-sensitive for folder names?

Git is a unix based code. its is case sensitive so it will allow you to have the same name in different cases, and as you except windows will not be tolerated for this. There is nothing you can do about it beside renaming your folders.

Are filenames case-sensitive on github?

Git has a configuration setting that tells it whether to expect a case-sensitive or insensitive file system: core. ignorecase . To tell Git to be case-senstive, simply set this setting to false .


2 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!

See "Git: Changing capitalization of filenames"

like image 163
VonC Avatar answered Oct 24 '22 23:10

VonC


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 
like image 20
Brandon Yang Avatar answered Oct 25 '22 01:10

Brandon Yang