How do I commit case-sensitive only filename changes in Git?

前端 未结 16 2305
我在风中等你
我在风中等你 2020-11-22 03:31

I have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to de

16条回答
  •  时光说笑
    2020-11-22 04:08

    Sometimes it is useful to temporarily change Git's case sensitivity.

    Method #1 - Change case sensitivity for a single command:

    git -c core.ignorecase=true checkout mybranch to turn off case-sensitivity for a single checkout command. Or more generally: git -c core.ignorecase= <> <>. (Credit to VonC for suggesting this in the comments.)

    Method #2 - Change case sensitivity for multiple commands:

    To change the setting for longer (e.g. if multiple commands need to be run before changing it back):

    1. git config core.ignorecase (this returns the current setting, e.g. false).
    2. git config core.ignorecase <> - set the desired new setting.
    3. ...Run multiple other commands...
    4. git config core.ignorecase <> - set config value back to its previous setting.

提交回复
热议问题