我在 Windows 上遇到了 .gitignore
的奇怪问题。
我希望 git 忽略所有 .exe
文件,Dependencies
文件夹(以及所有子文件夹)中的文件除外。
所以我有:
.gitignore
:
*.exe
!/Dependencies/**/*.exe
不幸的是,这不起作用。
同时,这样做:
*.exe
!/Dependencies/folder/subfolder/*.exe
所以我想知道,我是不是搞砸了,或者这是某种错误?
我在 Windows (Windows 7 x64) 版本 1.6.5.1-preview20091022 上运行 msysgit
提前感谢您的任何输入:)
最佳答案
自 git 1.8.2 (March, 8th 2013) ,现在支持 **
:
The patterns in
.gitignore
and.gitattributes
files can have**/
, as a pattern that matches 0 or more levels of subdirectory.E.g. "
foo/**/bar
" matches "bar
" in "foo
" itself or in a subdirectory of "foo
".
在您的情况下,这意味着现在可能支持此行:
!/Dependencies/**/*.exe
关于windows - .gitignore 不理解我在 Windows 上的文件夹通配符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2330471/