Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top