Sample Header Ad - 728x90

How to negate a gitignore pattern containing spaces?

3 votes
2 answers
3098 views
My .gitignore starts by excluding everything, and then negating everything that I want to include, to avoid lots of noise in git status: * !awesome/ !calibre/ […] However, after installing Visual Studio Code I can't seem to negate the match for the directory "Code - OSS". I've tried the following lines: !Code - OSS/ !Code\ -\ OSS/ !'Code - OSS/' !"Code - OSS/" !Code* With all of those lines at the bottom of my .gitignore git status still doesn't list this directory as available for inclusion. --- The output of git check-ignore --verbose Code\ -\ OSS with each of those lines is also strange: .config/.gitignore:22:!Code - OSS/ Code - OSS .config/.gitignore:22:!Code\ -\ OSS/ Code - OSS .config/.gitignore:1:* Code - OSS .config/.gitignore:1:* Code - OSS .config/.gitignore:22:!Code* Code - OSS
Asked by l0b0 (53368 rep)
Sep 18, 2018, 03:18 AM
Last activity: Jun 24, 2025, 04:08 PM