Search code examples
gitgitignore

how to use .gitignore reverse select


use .gitignore to reverse selection,I just want to track the app catalog.App is the secondary directory under emply.

enter image description here

l used The following code,But git doesn't track anything

*
!*/
!*/app

I have already tested similar problems, Write like it, but invalid


Solution

  • Ignore everything, unignore top-level app and everything under it:

    *
    !/app/
    !/app/*