This is because when you wrote *
, git understood "ignore every files".
Git doesn't version folders, only files, so it saw adir/
as an empty directory.
質問
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?
解決
This is because when you wrote *
, git understood "ignore every files".
Git doesn't version folders, only files, so it saw adir/
as an empty directory.