To ignore the root file and root directories you could use:
/*
/*/
!/bin/
The above commands will ignore the root directories and root files, then un-ignores the root bin directory. Thus, you will get all of the bin directory, which includes subdirectories and their files.
This is the way to tell git to ignore everything except subdirectories.