gitignore.txt: clarify recursive nature of excluded directories

Additionally, precedence of negated patterns is exactly as outlined in the DESCRIPTION section, we don't need to repeat this. Signed-off-by: Karsten Blees <blees@dcon.de> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Karsten Blees committed Nov 7, 2013 at 22:36 UTC 59856de171397c355923ee6cd6debae89385c824
1 file changed +17 -2
Documentation/gitignore.txt
+17 -2
@@ -79,8 +79,10 @@ PATTERN FORMAT
79
80 - An optional prefix "`!`" which negates the pattern; any
81 matching file excluded by a previous pattern will become
82 - included again. If a negated pattern matches, this will
83 - override lower precedence patterns sources.
82 + included again. It is not possible to re-include a file if a parent
83 + directory of that file is excluded. Git doesn't list excluded
84 + directories for performance reasons, so any patterns on contained
85 + files have no effect, no matter where they are defined.
86 Put a backslash ("`\`") in front of the first "`!`" for patterns
87 that begin with a literal "`!`", for example, "`\!important!.txt`".
88
@@ -182,6 +184,19 @@ Another example:
184 The second .gitignore prevents Git from ignoring
185 `arch/foo/kernel/vmlinux.lds.S`.
186
187 +Example to exclude everything except a specific directory `foo/bar`
188 +(note the `/*` - without the slash, the wildcard would also exclude
189 +everything within `foo/bar`):
190 +
191 +--------------------------------------------------------------
192 + $ cat .gitignore
193 + # exclude everything except directory foo/bar
194 + /*
195 + !/foo
196 + /foo/*
197 + !/foo/bar
198 +--------------------------------------------------------------
199 +
200 SEE ALSO
201 --------
202 linkgit:git-rm[1],