On Sat, Dec 7, 2013 at 12:26 AM, Martin Langhoff <martin.langhoff@xxxxxxxxx> wrote: > # Untracked files: > # (use "git add <file>..." to include in what will be committed) > # > # modules/boring/ > # modules/interesting/other.c > > $ echo '/modules/' > .gitignore > $ echo '!/modules/interesting/' >> .gitignore Once you ignore the directory "modules", it won't bother with anything inside. As a result, !/modules/interesting/ is ignored. Turning the first rule to /modules/* like Jiang Xin showed does the trick because git is told to ignore entries inside 'modules', not 'modules' itself. I think the best we could do is turning /modules/ into /modules/* internally. But it only works for simple cases like yours. If you write /mo*ules/, I don't think we can make git smart enough to correlate /mo*ules/ to !/modules/interesting/. So the second best thing is improve documents about this case, which is what kb/doc-exclude-directory-semantics does (currently on 'next'). -- Duy -- 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