Skip to content
Browse files

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 <>
Reviewed-by: Jeff King <>
Signed-off-by: Junio C Hamano <>
  • Loading branch information...
kblees authored and gitster committed Nov 7, 2013
1 parent 8447dc8 commit 59856de171397c355923ee6cd6debae89385c824
Showing with 17 additions and 2 deletions.
  1. +17 −2 Documentation/gitignore.txt
@@ -79,8 +79,10 @@ PATTERN FORMAT

- An optional prefix "`!`" which negates the pattern; any
matching file excluded by a previous pattern will become
included again. If a negated pattern matches, this will
override lower precedence patterns sources.
included again. It is not possible to re-include a file if a parent
directory of that file is excluded. Git doesn't list excluded
directories for performance reasons, so any patterns on contained
files have no effect, no matter where they are defined.
Put a backslash ("`\`") in front of the first "`!`" for patterns
that begin with a literal "`!`", for example, "`\!important!.txt`".

@@ -182,6 +184,19 @@ Another example:
The second .gitignore prevents Git from ignoring

Example to exclude everything except a specific directory `foo/bar`
(note the `/*` - without the slash, the wildcard would also exclude
everything within `foo/bar`):

$ cat .gitignore
# exclude everything except directory foo/bar


0 comments on commit 59856de

Please sign in to comment.
You can’t perform that action at this time.