`.gitignore` has `logs/` and `!logs/keep.txt`, but `logs/keep.txt` is still ignored.
IntermediateTroubleshootingConfig, Line Endings, Files and Platform Quirks
Answer
Likely causes → Git cannot re-include a file if its parent directory is excluded; once logs/ is ignored, Git never looks inside it, so the negation has no effect.
Diagnose → git check-ignore -v logs/keep.txt shows which rule wins.
Fix → Ignore the contents, not the directory, then negate:
logs/*
!logs/keep.txt
For nested paths, each parent level must be un-ignored (build/*, !build/config/, build/config/*, !build/config/app.yml).
Prevent → Test ignore rules with git check-ignore -v and git status --ignored.
More on Config, Line Endings, Files and Platform Quirks
`warning: in the working copy of 'app.sh', LF will be replaced by CRLF the next time Git touches it`Beginner`git diff` shows `old mode 100755` / `new mode 100644` for hundreds of files with no content change.BeginnerCloning on Windows fails with `error: unable to create file src/very/deep/.../component.test.ts: Filename too long`.BeginnerYou renamed `header.tsx` to `Header.tsx` on macOS. Locally everything builds, but Linux CI fails with `Module not found: Can't resolve './components/Header'`.IntermediateCheckout on Windows fails with `error: invalid path 'logs/2024-01-01T10:00:00.log'` (or `'docs/aux.md'`) and `fatal: unable to checkout working tree`.IntermediateClone prints `warning: the following paths have collided (e.g. case-sensitive paths on a case-insensitive filesystem) and only one from the same colliding group is in the working tree:`Intermediate