How do negated patterns work in .gitignore?
I think that what you actually want to do is: aaa/* !aaa/ccc You’re telling it “don’t look in aaa” so it never even examines the path aaa/ccc. If you use the wildcard, it still reads the contents of aaa, then each entry matches the wildcard and is ignored, except aaa/ccc which gets put back in.