I'm using msysgit 1.9.4.
My .gitignore file, at the root of the repo, looks like this:
build/
a/b/
!a/c/d/e/**/build/
My intent is that, all build/ directories are ignored, unless they are subdirs (any depth) of a/c/d/e/. But a/c/d/e/f/build/ is still getting ignored by Git.
What am I missing here?
The general rule of gitignore is simple:
It is not possible to re-include a file if a parent directory of that file is excluded.
To exclude files (or all files) from a subfolder of an ignored folder build, you need to exclude the folder first, then the files:
I have tested:
**/build/
a/b/
!a/c/d/e/**/build/ <== whitelist folder first
!a/c/d/e/**/build/** <== then the files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With