gitignore.txt: suggestions how to get literal # or ! at the beginning
We support backslash escape, but we hide the details behind the phrase "a shell glob suitable for consumption by fnmatch(3)". So it may not be obvious how one can get literal # or ! at the beginning of pattern. Add a few lines on how to work around the magic characters. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Oct 7, 2012 at 10:13 UTC
866f5f82b9fdedb0304708f9b78db1409fecd046
1 file changed
+5
-1
Documentation/gitignore.txt
+5
-1
@@ -68,11 +68,15 @@ PATTERN FORMAT
68
for readability.
69
70
- A line starting with # serves as a comment.
71
+ Put a backslash ("`\`") in front of the first hash for patterns
72
+ that begin with a hash.
73
72
- - An optional prefix '!' which negates the pattern; any
74
+ - An optional prefix "`!`" which negates the pattern; any
75
matching file excluded by a previous pattern will become
76
included again. If a negated pattern matches, this will
77
override lower precedence patterns sources.
78
+ Put a backslash ("`\`") in front of the first "`!`" for patterns
79
+ that begin with a literal "`!`", for example, "`\!important!.txt`".
80
81
- If the pattern ends with a slash, it is removed for the
82
purpose of the following description, but it would only find