I think you want:

**/*data*
# same as *data*, but with the 'at any level' markers to match the next 
pattern
!**/*data*/
# do not (!) ignore *data* _directories_(trailing slash) at any level (**/)


The use of the ** code causes much confusion.

I have not tested it.
This is case sensitive. so you may need [Dd] to cover Data and data.
--
Philip

On Thursday, December 15, 2016 at 8:15:53 AM UTC, Xia Hong wrote:

> /*
> *data*
> !/data
> !/model
>
> is this OK?
> 在 2016年12月15日星期四 UTC+8上午2:23:30,Xia Hong写道:
>>
>> Hi , ALL
>> I don't understand .gitignore well, how should i make it?
>>
>> my git version is 1.8.3.1
>>  
>> 1. "Trailing spaces are ignored unless they are quoted with backslash 
>> ("\")." 
>>  seem not always work.  *end '/'  with or without t**railing spaces will 
>> be differnet, in my test.*
>>
>> 2. in my opinion, why logic of gitignore is so strange? Office 
>> Documentation is not clear:
>>
>> 1)  i guess rules of format pattern is take one by one like* if ...:then 
>> ... [elif ... : ...]+ else:...* so the last  leading slash "*/pattern*" 
>> how to work? logically , before has some *Otherwise, is it strange that 
>> some if after final else?  and how pattern to be solved ?my understanding 
>> is fnmatch?*
>>
>> 2) "Git treats it as a shell glob pattern and checks for a match against 
>> the pathname relative to the location of the .gitignore file (relative 
>> to the toplevel of the work tree if not from a .gitignore file)."* i 
>> don't understand it personally, how shell glob pattern work , and how 
>> function parametrs set ?* and  then stackoverflow some results 
>> <http://stackoverflow.com/questions/24139478/when-to-use-leading-slash-in-gitignore>
>>  , 
>> i retest it and find this rule will try  recursive the directory tree to 
>> find possible pattern matchs. Is the above url's understanding correct?
>>
>> 3)  the overall logic seem *strange and unclear* for me personally, it 
>> seems i have to read source code to get all logic.
>> *I don't feel clear enough neither the big picture nor the details to 
>> design .gitignore. *for example, why we can reinclude subdirectory but 
>> not files...
>>
>> Sorry for my stupid questions, thanks very much for listening my 
>> complains....
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to