How do I ignore a directory in the root of my git repository, but include it further down in the tree? July 25, 2023 by Tarik Use a leading / /file.x That will only match a top level file.x but not one lower down, in “want/file.x”, say.