--- title: "TIL: Including subfiles of ignored directories" date: 2022-11-25T00:00:00 slug: til-including-subfiles-of-ignored-directories --- Okay that title is a bit of a mess. Here's the problem, you have a directory that looks like this: ```bash - app.ts - scripts - file.sh - anotherfile.sh - build.js - node_modules ``` Previously I didn't want to upload anything in `scripts`, however now I've added `build.js` and I _would_ like that uploaded. My `.ignore` looks like this right now: ```ignore node_modules scripts/ ``` I initially thought that just adding an exception for the file would work: ```ignore node_modules scripts/ !scripts/build.js ``` But nope! That doesn't work. At first I thought it was to do with specificity, but reordering had no effect either. It turns out, what I actually needed was: ```ignore node_modules scripts/* !scripts/ !scripts/build.js ``` This means I exclude everything inside the scripts directory, but it still allows me to explicitly include my `build.js` file.