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:
- 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.
.ignore looks like this right now:
I initially thought that just adding an exception for the file would work:
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:
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