This is a smart pattern with .dockerignore where it keeps a lot of huge things from getting copied into the context... but it's also so confusing every time your container doesn't have the new file you created.
I think you're going to have to allow `app/*` which means you will be checking in some .DS_STORE files anyway.
There's something similar I've done programming on linux. I've been working on some things in Odin programming language for a while and there are a ton of changes I've made where the commit contained an executable, because when Odin compiler makes the executable it names it after the main package's directory, without suffix.
Once I complained about this to the community someone suggested a clever gitignore hack:
*
!*/
!*.*
This by default ignores all files, except those that have a suffix and directories. I think this is a useful lesson - if you flip which files you ignore you can change the failure mode from "I accidentally committed a huge file into a repo" to "why isn't it working?". The latter can be pretty much be answered by good CI testing (maybe not always though).
I kinda like it, but if you come to think of it, that's just a misuse of `git add -A`. Nothing goes into a git repository unless you specifically add it, so why not just be more careful when adding files?
6 comments
[ 3.0 ms ] story [ 24.0 ms ] threadI think you're going to have to allow `app/*` which means you will be checking in some .DS_STORE files anyway.
Once I complained about this to the community someone suggested a clever gitignore hack:
This by default ignores all files, except those that have a suffix and directories. I think this is a useful lesson - if you flip which files you ignore you can change the failure mode from "I accidentally committed a huge file into a repo" to "why isn't it working?". The latter can be pretty much be answered by good CI testing (maybe not always though).The only sticking point is when I forget to use `git add -u .` when committing changes to files which are already being tracked.
I don't remember why I went with this over the global * ignore.