.gitignore – Ignore everything in a directory except one file
It seems ! only works if the file is in the same folder. A possible workaround would be to nest the same statement till you get to your final file. A bit messy, but it works. public/typings/* !public/typings/browser public/typings/browser/* !public/typings/browser/ambient public/typings/browser/ambient/* !public/typings/browser/ambient/jquery public/typings/browser/ambient/jquery/* !public/typings/browser/ambient/jquery/jquery.d.ts