我在这里搜索这个答案,但没有什么是相似的,或者我迷路了。我试图排除除一个文件夹以外的所有特定子文件夹。也许我可以手动完成所有路径,但我认为应该有一个聪明的方法。我的文件结构:Gitignore排除子文件夹(** /模式),除了特定的一个
.gitignore
test/
file1
file2
sim_case/
file1
file2
include/
file1
file2
在的.gitignore我:
**/sim_case
,那就是排除一切从sim_case,但我想包括文件夹“包括”。我尝试了一些变化,没有任何工作。
!**/sim_case/include
!**/sim_case/include/
!**/sim_case/include/*
!sim_case/include/
!sim_case/include/
!sim_case/include/*
这将随着2.8而改变。 http://stackoverflow.com/a/20652768/6309。 'test/sim_case'然后是'!test/sim_case/include'就足够了。 – VonC