Git: Whitelist Directory Subfiles

Rating: 4

I already knew you could ignore everything in a git repo by default, by including * in .gitignore, and then white-list specific files by prepending them with !:

# Ignore everything...

# ... but not these files.

But when I tried to whitelist a subfile of a directory it didn’t work. That’s because you need to add !*/: