.gitignore: How do I ignore nested directories?

孤街浪徒 提交于 2019-12-06 16:37:56

问题


I have the following directory structure:

test/a
test/b/c
test/a/b/Ouput
test/c/d/e/Output
test/f/Output

I want to ignore all the "Output" directories under "test". I tried test/**/Output, but it didn't work. What am I doing wrong?


回答1:


You said you want the Output/ pattern to match only under the test/ directory, so in the test/ directory, create a .gitignore file with the contents:

Output/

If you put this pattern in your top-level .gitignore file, then it will match in all directories under the top directory.




回答2:


Since version 1.8.2 (March, 8th 2013), git supports ** in .gitignore files, so using test/**/Output/ will ignore only Output sub-directories under test directory.



来源:https://stackoverflow.com/questions/12685134/gitignore-how-do-i-ignore-nested-directories

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