Skip to content

Commit 0f0ce07

Browse files
shreyp135gitster
authored andcommitted
doc: gitignore: clarify pattern base for info/exclude and core.excludesFile
The pattern format section describes how patterns are interpreted relative to the location of a .gitignore file, but does not mention the behavior for exclude sources outside the working tree. Clarify that patterns from $GIT_DIR/info/exclude and core.excludesFile are treated as if they are specified at the root of the working tree, so a leading '/' anchors matches at the repository root. Reported-by: Dan Drake <dan@dandrake.org> Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9a2fb14 commit 0f0ce07

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Documentation/gitignore.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ PATTERN FORMAT
9696
particular `.gitignore` file itself. Otherwise the pattern may also
9797
match at any level below the `.gitignore` level.
9898
99+
- Patterns read from exclude sources that are outside the working tree,
100+
such as $GIT_DIR/info/exclude and core.excludesFile, are treated as if
101+
they are specified at the root of the working tree, i.e. a leading "/"
102+
in such patterns anchors the match at the root of the repository.
103+
99104
- If there is a separator at the end of the pattern then the pattern
100105
will only match directories, otherwise the pattern can match both
101106
files and directories.

0 commit comments

Comments
 (0)