diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-07 13:38:17 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-07 13:38:17 -0700 |
commit | 506d8f1b394917c345965fc1762afa66678870c1 (patch) | |
tree | 6ff88fa3da3500254ac3b364fbf99bb95ddb5247 /Documentation/gitignore.txt | |
parent | 2b72dbbcf3a1d6c6813db2c13afaa1d0d8585f7b (diff) | |
parent | 57534ee77d22e725d971ee89c77dc6aad61c573f (diff) | |
download | git-506d8f1b394917c345965fc1762afa66678870c1.tar.gz |
Merge branch 'nd/ignore-then-not-ignore'
Allow a later "!/abc/def" to override an earlier "/abc" that
appears in the same .gitignore file to make it easier to express
"everything in /abc directory is ignored, except for ...".
* nd/ignore-then-not-ignore:
dir.c: don't exclude whole dir prematurely if neg pattern may match
dir.c: make last_exclude_matching_from_list() run til the end
Diffstat (limited to 'Documentation/gitignore.txt')
-rw-r--r-- | Documentation/gitignore.txt | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index 473623d631..79a1948a0b 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -82,12 +82,12 @@ PATTERN FORMAT - An optional prefix "`!`" which negates the pattern; any matching file excluded by a previous pattern will become - 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. + included again. Put a backslash ("`\`") in front of the first "`!`" for patterns that begin with a literal "`!`", for example, "`\!important!.txt`". + It is possible to re-include a file if a parent directory of that + file is excluded if certain conditions are met. See section NOTES + for detail. - If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find @@ -141,6 +141,21 @@ not tracked by Git remain untracked. To stop tracking a file that is currently tracked, use 'git rm --cached'. +To re-include files or directories when their parent directory is +excluded, the following conditions must be met: + + - The rules to exclude a directory and re-include a subset back must + be in the same .gitignore file. + + - The directory part in the re-include rules must be literal (i.e. no + wildcards) + + - The rules to exclude the parent directory must not end with a + trailing slash. + + - The rules to exclude the parent directory must have at least one + slash. + EXAMPLES -------- |