如何忽略文件扩展名的混帐不区分大小写?(How do I ignore file extension

2019-06-25 14:43发布

我想告诉混帐无论扩展是怎么写的忽略如JPG文件。

* .JPG

应该忽略

为.jpg,.JPG,.JPG

等等

这有可能不告诉混帐完全忽略呢?

Answer 1:

混帐忽略了解到glob模式,所以你可以使用这个

*.[jJ][pP][gG]


Answer 2:

你可以告诉git的在大多数情况下忽略的情况下,包括在你的.gitignore文件。 所有你需要的是:

git config core.ignorecase true

从实际情况来看,有可能是权衡参与。 git的-配置(1)手册页说:

   core.ignorecase
       If true, this option enables various workarounds to enable git to
       work better on filesystems that are not case sensitive, like FAT.
       For example, if a directory listing finds "makefile" when git
       expects "Makefile", git will assume it is really the same file, and
       continue to remember it as "Makefile".

       The default is false, except git-clone(1) or git-init(1) will probe
       and set core.ignorecase true if appropriate when the repository is
       created.

所以,如果你是一个区分大小写的文件系统,你可能会遇到麻烦。 你的旅费可能会改变。



文章来源: How do I ignore file extensions in git regardless of case?
标签: git gitignore