I want to include all the *.meta files in the Assets directory and all subdirectories while excluding everything else in Assets
I tried
/Assets/*
!/Assets/**/*.meta
!*.meta
but that only include *.meta within /Assets ????
Thanks for any help
I want to include all the *.meta files in the Assets directory and all subdirectories while excluding everything else in Assets
I tried
/Assets/*
!/Assets/**/*.meta
!*.meta
but that only include *.meta within /Assets ????
Thanks for any help
First, if an ignore rule does not work, you can check this with git check-ignore
:
git check-ignore -v -- yourFile
It will display which ignore rule ignore a file that you thought should not be ignored.
Then the main rule to remember when it comes to ignore is:
It is not possible to re-include a file if a parent directory of that file is excluded. (
*
)
(*
: unless certain conditions are met in git 2.?+, see below)
That is why your rules only include *.meta
within /Assets
(and not the subdirectories)
You would need to include all parent folders of a file (as in this recent example) in order to include a file
/Assets/**/**
! /Assets/**/
!/Assets/**/*.meta
I tested it with git 2.4.1 and it works (even on Windows).
It does include only the *.meta
files in Assets
and all subdirectories, but exclude everything else.
Note that with git 2.9.x/2.10 (mid 2016?), it might be possible to re-include a file if a parent directory of that file is excluded if there is no wildcard in the path re-included.
Nguyễn Thái Ngọc Duy (pclouds
) is trying to add this feature:
However, since one of the condition to re-inclusion was:
The directory part in the re-include rules must be literal (i.e. no wildcards)
That would not have worked here.