问题描述
我想忽略存储库中的所有文件,除了 bin
子目录中出现的文件。我尝试将以下内容添加到我的 .gitignore
中:
*
!bin / *
然而,这并没有达到预期的效果:我创建了一个新文件在 bin /
中,但是做 git status
仍然显示没有提交(working directory clean )
。
有任何建议? 这忽略了根文件&然后取消忽略root bin目录:
/ *
/ * /
! / bin /
通过这种方式,您可以获得所有bin目录,包括子目录及其文件。 p>
I want to ignore all files in my repository except those that occur in the bin
subdirectory. I tried adding the following to my .gitignore
:
*
!bin/*
This does not have the desired effect, however: I created a new file inside of bin/
, but doing git status
still shows nothing to commit (working directory clean)
.
Any suggestions?
This ignores root files & root directories, then un-ignores the root bin directory:
/*
/*/
!/bin/
This way you get all of the bin directory, including subdirectories and their files.
这篇关于我如何让Git忽略除子目录以外的所有内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!