I have a large code base (say, a wordpress installation) and want to ignore everything except the few files I myself changed (say, a theme). I know I can ignore files except some single files with
/foo/*
!/foo/bar
But if the directory I want to keep is deeply nested, this does not work. I tried:
/foo/*
!/foo/bar/baz
but baz
is ignored as well. There is a proposed solution in a different question that works like
/foo/*
!/foo/bar
/foo/bar/*
!/foo/bar/baz
but this grows to a damn PITA if the directory I want to keep is nested deeper.
Is there a simpler solution to keep /foo/bar/baz
but ignore everything else?