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.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
# Ignore everything
*
# But not these files...
!.gitignore
!script.pl
!template.latex
# etc...
# ...even if they are in subdirectories
!*/
# if the files to be tracked are in subdirectories
!*/a/b/file1.txt
!*/a/b/c/*
<!-- end snippet -->
> 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.
<!-- language: sh -->
# Ignore everything
*
# But not these files...
!.gitignore
!script.pl
!template.latex
# etc...
# ...even if they are in subdirectories
!*/
# if the files to be tracked are in subdirectories
!*/a/b/file1.txt
!*/a/b/c/*