限制.gitignore的深度
由于各种原因,我在项目根目录的 .gitignore
中添加了以下条目:
*.c
如我所愿,这会忽略包含的所有 C 文件。但是,我真的只希望根目录中的 C 文件被忽略,而不是所有子目录:
foo.c
bar.c
folder/baz.c
在上面的方案中,我只希望忽略 foo.c 和 bar.c 。我不希望这个 gitignore 规则递归地工作。我该怎么做?
我知道可以使用 !*.c
否定该规则,但我不想对每个子目录都这样做。 (这就是我目前正在做的事情)。
For various reasons, I have the entry in my .gitignore
in the root of a project:
*.c
As I desire, this ignores all C files from being included. However, I really only want the C files to only be ignored in the root directory, and not all the sub-directories:
foo.c
bar.c
folder/baz.c
In the above scheme, I only want foo.c and bar.c ignored. I do not want this gitignore rule to work recursively. How do I do this?
I'm aware of being able to negate the rule with !*.c
, but I'd rather not do that for every subdirectory. (This is what I am currently doing).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要这样做:
我正在从联机帮助页中寻找一些内容来引用,并发现这个确切的示例就在那里!哎呀!
You want to do this:
I was looking for a bit from the manpage to quote, and found that this exact example's in there! Oops!