How do I tell Git to ignore everything except a subdirectory?

This ignores root files & root directories, then un-ignores the root bin directory:

/*
/*/
!/bin/

This way you get all of the bin directory, including subdirectories and their files.

Leave a Comment