I'm excluding a folder a and its subfolders, but want to have a specific subfolder b included, where b can be a subfolder somewhere below a, and the exact path to b has not been specified.
My .gitignore
contains these lines:
a/**
!a/**/b
however this does not work. Have tried numerous other permutations of the above, including from other posts on stack overflow, but nothing appears to work.
The previous question on stackoverflow deals with the situation where you can explicitly declare the path to the subdirectory. In this question, the situation I'm addressing is where b
can be any subfolder underneath a
, and not a predetermined path.
Further the earlier solution requires you to "unignore" every parent directory of anything that you want to "unignore". However in this case I'm trying to create a generic rule that allows this subdirectory without bothering about where it is in the directory tree. So the earlier solution does not work/apply in this situation.