如何git忽略子文件夹/子目录? [英] How to git ignore subfolders / subdirectories?
问题描述
.Net解决方案中有很多项目。我想排除所有 bin / Debug和 bin / Release文件夹(及其内容),但仍包括 bin文件夹本身以及其中包含的任何dll。
I have a lot of projects in my .Net solution. I would like to exclude all "bin/Debug" and "bin/Release" folders (and their contents), but still include the "bin" folder itself and any dll's contained therein.
.gitignore和 bin /会忽略 Debug和 Release文件夹,但也会忽略 bin文件夹中包含的所有dll。
.gitignore with "bin/" ignores "Debug" and "Release" folders, but also any dll's contained in the "bin" folder.
bin .gitignore文件中的 / Debug或 bin / Release不排除目录,除非我将忽略模式完全限定为 Solution / Project / bin / Debug-我不想这样做,因为我将不需要在我的解决方案中将每个项目的完整模式都包括在内,并为添加的任何新项目添加它。
"bin/Debug" or "bin/Release" in the .gitignore file does not exclude the directories, unless I fully qualify the ignore pattern as "Solution/Project/bin/Debug" - which I don't want to do as I will need to include this full pattern for each project in my solution, as well as add it for any new projects added.
有什么建议吗?
推荐答案
您是否尝试过通配符?
Solution/*/bin/Debug
Solution/*/bin/Release
使用git 1.8.2版,您还可以使用 **
通配符来匹配任何级别的子目录:
With version 1.8.2 of git, you can also use the **
wildcard to match any level of subdirectories:
**/bin/Debug/
**/bin/Release/
这篇关于如何git忽略子文件夹/子目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!