Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git ignore changes in case?

Tags:

git

windows

People also ask

How do I ignore new changes in git?

Use Git update-index to ignore changes Or, you can temporarily stop tracking a file and have Git ignore changes to the file by using the git update-index command with the assume-unchanged flag.

How do I get permission to ignore a file in Git?

If you set core. filemode=false then git will ignore execute bit changes, no need to change local permissions. Unless you've already added permission changes to the index, in which case you're missing the step where you would need to git add after you turn off core.

Is Gitignore case-sensitive?

Just a note: gitignore is case-sensitive.


Since version 1.5.6 there is an ignorecase option available in the [core] section of .git/config

e.g. add ignorecase = true

To change it for just one repo, from that folder run:

git config core.ignorecase true

To change it globally:

git config --global core.ignorecase true

You can force git to rename the file in a case-only way with this command:

git mv --cached name.txt NAME.TXT

Note this doesn't change the case of the file in your checked out copy on a Windows partition, but git records the casing change and you can commit that change. Future checkouts will use the new casing.


In git version 1.6.1.9 for windows I found that "ignorecase=true' in config was already set by default.


The situation described in the question is now re-occuring with Mac OS X, git version >= 1.7.4 (I think). The cure is to set your ignorecase=false and rename the lowercased files (that git changed that way, not Visual Studio) back to their UsualCase by hand (i.e. 'mv myname MyName').

More info here.


To force git to recognize the change of casing to a file, you can run this command.

  1. Change the File casing however you like
  2. git mv -f mynewapp.sln MyNewApp.sln

The previous command seems to be deprecated now.