I've a directory projects/
in root directory. the root directory is added to git. in projects I've several subdirectories. But I want to track only projects/admin
not projects/x
nor projects/y
. What ignore rule I need to write in .gitignore
?
You can use a negative ignore clauses, e.g.:
project/*
!project/admin
!project/admin/*
projects/*
!projects/admin
The !
prefix before a line negates it; i.e. the directory or file given in that line will not be ignored.
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