windows - .gitignore 不理解我在 Windows 上的文件夹通配符

标签 windows git msysgit gitignore

我在 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/

相关文章:

windows - git,Windows 上的 SSH_ASKPASS

windows - 无法在 Windows 7 中停止 IIS

c++ - 使用 vs 代码调试文件时,如何将文件传递到我的程序中

java - JList 类型不是通用的;它不能用参数 <String> 参数化

git - 将二进制文件附加到 Git 标记

git - 删除两个提交之间的 git 提交

git - 如何使用 msysgit/gitk 设置 DiffMerge?

c++ - 如何在 Windows 上以编程方式等效地查询 proc 文件系统?

python - 如何通过PyGithub将分支 merge 到master

android - 将 Repo 与 Msysgit 结合使用