开发者

Limit depth of .gitignore

For various reasons, I have the entry in my .gitign开发者_开发技巧ore 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).


You want to do this:

/*.c

I was looking for a bit from the manpage to quote, and found that this exact example's in there! Oops!

A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜