.gitignore slash after wildcard changes exclude behaviour
If the .gitignore file looks like this:
then the directory adir will not be included. However, if I change it to:
Now it works – all directories are ignored but adir. Why is that? What is the proper way of ignoring everything but some particular directories?
Based on the answer, I changed it to:
* !adir/ !adir/*
and it works. But is there any preferred way?
One Solution collect form web for “.gitignore slash after wildcard changes exclude behaviour”
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.