Since I wrote the original answer (in 2013), I believe my intent was to anchor the exclusion at the top folder '/
' (where the .gitignore
is), with the special format:
A trailing "/**
" matches everything inside. For example, "abc/**
" matches all files inside directory "abc
", relative to the location of the .gitignore
file, with infinite depth.
Meaning I want to exclude all folders (**/
) starting from the top (/
: inside top folder).
That is a more complex way to write */
with:
- '
*
': match anything (except '/
') at any depth
- '
/
': match only folders (which ends with '/
')
In both instances, the idea remains:
- ignore everything
- except folders
- then except dot files