If the .gitignore file looks like this:
*
!adir/
then the directory adir will not be included. However, if I change it to:
*/
!adir/
Now it works - all directories are ignored but adir. Why is that? What is the proper way of ignoring everything but some particular directories?
EDIT: Based on the answer, I changed it to:
*
!adir/
!adir/*
and it works. But is there any preferred way?