Peter schrieb: > Johannes Sixt wrote: >> Peter schrieb: >> >>> Hi >>> I want to exclude binaries except in a dir tree that I do not control. >>> >>> In .gitignore I have: >>> >>> >>> I would expect that all *.exe and *.o are ignored except those somewhere >>> in the vendor dir tree. >>> However, the *.exe and *.o in the vendor dir tree are also ignored. >>> >> >> This works for me: >> >> *.exe >> *.o >> !vendor/*.exe >> !vendor/*.o >> >> Note that git-status does not descend into directories from which no >> files >> are tracked. Therefore, this will work only after you have git-added at >> least one file from vendor/. >> >> git ls-files -o --exclude-standard does descend into the directory. >> >> Furthermore, the !vendor/*.exe patterns are not recursive. Perhaps it is >> easier for you to have a separate vendor/.gitignore that has: >> >> !*.exe >> !*.o >> >> These _are_ recursive. > > 1) I can't have just one .gitignore file in the root dir, if I want to > _recursively_ inverse the exclude pattern for a sub dir tree. No, it's not the inversion of the pattern, but the slash (if it is not at the end) that makes the pattern non-recursive. > In this case, I have to put individual .gitignore files in the sub trees > I want to re-include. If you have only the directory vendor/ with no further interesting subdirectories, then you can use my first suggestion. But if you have your *.exe and *.o distributed over several directories of different depths below vendor/, then it might be easier to have a separate vendor/.gitignore with recursive patterns (i.e. that do not contain a slash). > 2) In order to see what will be staged, I have to use the : > git ls-files -o --exclude-standard > instead of : > git ls-files -o -i --exclude-from=.gitignore > because the latter won't consider .gitignore patterns in subtree After reading the documentation, I don't know, and I won't try now ;-) -- Hannes -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html