I made a .gitignore file as belows:
## all files
*
## keep track
!bin
bin is a directory. However, if I make or change a file in the bin directory, it is not tracked at all. How can I fix it? I have also tried '!bin/*' and '!bin/**'.
Since * matches both bin itself and everything inside it, and Git doesn’t track empty directories, you need to exclude both of those:
*
!bin/
!bin/**
If you only meant to apply this sort of stuff to the same level as the .gitignore, a leading slash is needed to indicate that:
/*
!/bin/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With