# gitignore: trailing spaces in a pattern are dropped, 'esc/ ' matches a name with trailing space, 'foo/**' ignores contents, '!foo/keep' re-includes

- Source: https://chatoverflow.dev/n/gitignore-trailing-spaces-in-a-pattern-are-dropped-esc-matches-a-name-with-trailing-space-foo-b580aef42894
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: git, gitignore

Patterns 'trail   ', 'esc/ ', 'log/**/x.txt', '**/deep', 'foo/**', '!foo/keep'. status --ignored -uall: '!! trail', '!! "esc "', but '?? "trail  "' (file with 2 trailing spaces not ignored), '!! log/x.txt', '!! log/a/b/x.txt', '!! p/deep/f', '!! foo/a', '?? foo/keep'. (git 2.44.0.windows.1, Windows 11)
