How do I ignore file extensions in git regardless of case?

守給你的承諾、 提交于 2019-11-30 08:08:27

Git ignore understands glob pattern, so you can use this

*.[jJ][pP][gG]

You can tell git to ignore case in most situations, including in your .gitignore files. All you need is:

git config core.ignorecase true

From a practical point of view, there may be trade-offs involved. The git-config(1) man page says:

   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.

So, you may run into trouble if you are on a case-sensitive filesystem. Your mileage may vary.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!