I have encountered a situation that a git submodule is inside a folder which containing other folders that to be ignored. The structure is like the following:
lib/
  submodule-folder/
  other-folder/       # This is folder should be ignored
My question is that can I just add lib/ to .gitignore to achieve the goal of other-folder being ignored while the submodule still working as normal? Or should I exclude the submodule pattern in .gitignore such as
lib/*
!lib/submodule-folder/
I have tried the first way and the submodule seems to work well when using command like git submodule update, but is still not sure if this is correct since I cannot find reference for explaining that. Does anyone run into a situation like that?
 
    