Strange behaviour of Git: mysterious changes cannot be undone

后端 未结 3 535
误落风尘
误落风尘 2020-12-14 08:22

I am seeing a behaviour in Git which seems very mysterious to me. I keep a clone of the Linux repository from Github to play with Git locally. To be clear, I don\'t do much

相关标签:
3条回答
  • 2020-12-14 09:04

    The Linux source tree has filenames which differ in case only, which causes interesting failures on systems with case-insensitive filesystems.

    You need a case-sensitive filesystem in order to work with the Linux source.

    (include/linux/netfilter/xt_connmark.h and include/linux/netfilter/xt_CONNMARK.h are two different files in the Git repository, but only one can exist in your checkout at a time if your filesystem is case-insensitive.)

    0 讨论(0)
  • 2020-12-14 09:13

    As @ephemient said, this is because case insensitive file system. And I guess you are using Mac's HFS?

    For a simple solution on Mac, you can create a disk image, format the disk image with 'Case-sensitive Journaled HFS+':

    hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/git.dmg

    Then mount the disk image by open ~/git.dmg.

    And then do all git clone, git checkout operations in the mountable volumes.


    Or you need some third-party tool to convert HFS+ from case insensitive to case sensitive. As I know, some Mac Apps are made on case insensitive file systems, so some of them may failed to work if you do this convertion.

    0 讨论(0)
  • 2020-12-14 09:20

    Try updating submodules. I've gotten some weird, somewhat similar issues when a submodule included in a repository has been updated. Doing git submodule update may do the trick.

    0 讨论(0)
提交回复
热议问题