Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I change the capitalization of a directory and Git doesn't seem to pick up on it

Tags:

git

macos

People also ask

Is Gitconfig case sensitive?

Git is case-sensitive and your filesystem may not be - Weird folder merging on Windows - Scott Hanselman's Blog.


You can tell git to take account of the case by running

git config core.ignorecase false


You're probably using case insensitive (but case preserving) HFS+. I usually work round this like so:

$ git mv somename tmpname
$ git mv tmpname SomeName

How to git mv on Mac Case-Sensitively

This is happening because Mac OS X implements case preserving and case insensitivity features that are intended to help you.

Although the double rename suggestions in the other answer will work, I recommend the use of '--force' for a best practice result:

$ git mv --force somename SomeName


Note: if you try without the force option, git will barf on you like this:

$ git mv somename SomeName
$ fatal: destination exists, source=somename, destination=SomeName

In the above example, the git command fails and no files are changed in the filesystem or in git's index.


Try to change git config option core.ignorecase to false in your .gitconfig file.


The following steps helped me resolve the issue:

  1. Rename the folder to temp:

    mv Folder temp                  // It will rename your Folder to temp
    
  2. Stage and commit:

    git add .
    git commit -m "Temp"
    
  3. Rename temp folder to your choice:

    mv temp folder        // It will rename temp folder to the name of your choice(folder)
    git add .
    git commit -m "Folder Fixed"
    

Done - You can now push.