Skip to content

Commit 98ec4ad

Browse files
dakhubgitgitster
authored andcommitted
Documentation/gitignore.txt: Fix the seriously misleading priority explanation
Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a644ffd commit 98ec4ad

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Documentation/gitignore.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,26 @@ pattern.
1818

1919
When deciding whether to ignore a path, git normally checks
2020
`gitignore` patterns from multiple sources, with the following
21-
order of precedence:
21+
order of precedence, from highest to lowest (within one level of
22+
precedence, the last matching pattern decides the outcome):
2223

23-
* Patterns read from the file specified by the configuration
24-
variable 'core.excludesfile'.
25-
26-
* Patterns read from `$GIT_DIR/info/exclude`.
24+
* Patterns read from the command line for those commands that support
25+
them.
2726

2827
* Patterns read from a `.gitignore` file in the same directory
29-
as the path, or in any parent directory, ordered from the
30-
deepest such file to a file in the root of the repository.
28+
as the path, or in any parent directory, with patterns in the
29+
higher level files (up to the root) being overriden by those in
30+
lower level files down to the directory containing the file.
3131
These patterns match relative to the location of the
3232
`.gitignore` file. A project normally includes such
3333
`.gitignore` files in its repository, containing patterns for
3434
files generated as part of the project build.
3535

36+
* Patterns read from `$GIT_DIR/info/exclude`.
37+
38+
* Patterns read from the file specified by the configuration
39+
variable 'core.excludesfile'.
40+
3641
The underlying git plumbing tools, such as
3742
gitlink:git-ls-files[1] and gitlink:git-read-tree[1], read
3843
`gitignore` patterns specified by command-line options, or from
@@ -49,7 +54,8 @@ Patterns have the following format:
4954

5055
- An optional prefix '!' which negates the pattern; any
5156
matching file excluded by a previous pattern will become
52-
included again.
57+
included again. If a negated pattern matches, this will
58+
override lower precedence patterns sources.
5359

5460
- If the pattern does not contain a slash '/', git treats it as
5561
a shell glob pattern and checks for a match against the

0 commit comments

Comments
 (0)