summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-17 19:44:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-17 19:44:19 (GMT)
commitf9633716d0873b7d9173be2be603d5edec0a27d7 (patch)
treea7917b6213ca953a56f694274d6ec876a88d8aba /Documentation
parentd7aced95cd681b761468635f8d2a8b82d7ed26fd (diff)
parent59856de171397c355923ee6cd6debae89385c824 (diff)
downloadgit-f9633716d0873b7d9173be2be603d5edec0a27d7.zip
git-f9633716d0873b7d9173be2be603d5edec0a27d7.tar.gz
git-f9633716d0873b7d9173be2be603d5edec0a27d7.tar.bz2
Merge branch 'kb/doc-exclude-directory-semantics'
* kb/doc-exclude-directory-semantics: gitignore.txt: clarify recursive nature of excluded directories
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/gitignore.txt19
1 files changed, 17 insertions, 2 deletions
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index f971960..205e80e 100644
--- a/Documentation/gitignore.txt
+++ b/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
`arch/foo/kernel/vmlinux.lds.S`.
+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
+ /*
+ !/foo
+ /foo/*
+ !/foo/bar
+--------------------------------------------------------------
+
SEE ALSO
--------
linkgit:git-rm[1],