File format
.gitignore
Per-directory ignore patterns apply to intentionally untracked paths. Later matching rules at the same precedence level win; an excluded parent prevents re-inclusion of its children. Tracked files remain tracked.
Formal Syntax & Structure
git syntaxgit
pattern!exceptionWorking Example
Example Snippetgit
*.log!keep.log/build/*!/build/keep.txt