Skip to content

Commit

Permalink
gitignore.txt: suggestions how to get literal # or ! at the beginning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pclouds authored and gitster committed Oct 7, 2012
1 parent 889d358 commit 866f5f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Documentation/gitignore.txt
Expand Up @@ -68,11 +68,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
Expand Down

0 comments on commit 866f5f8

Please sign in to comment.