From: Nguyễn Thái Ngọc Duy Date: Sun, 07 Oct 2012 03:13:54 GMT Subject: [PATCH v3] gitignore.txt: suggestions how to get literal # or ! at the beginning Message-ID: <1349579634-13521-1-git-send-email-pclouds@gmail.com> In-Reply-To: <7vr4pbqwz7.fsf@alter.siamese.dyndns.org> 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 --- Back to spelling out, which works with 8.2.6. No examples for \# because '\' in '\#example#.txt' is eaten. Documentation/gitignore.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index 96639e0..90106c4 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -74,11 +74,15 @@ PATTERN FORMAT for readability. - A line starting with # serves as a comment. + Put a backslash ("`\`") in front of the first hash for patterns + that begin with a hash. - - An optional prefix '!' which negates the pattern; any + - 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. + Put a backslash ("`\`") in front of the first "`!`" for patterns + that begin with a literal "`!`", for example, "`\!important!.txt`". - If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find -- 1.7.12.1.406.g6ab07c4