git ignore all files and directories recursively except the .gitignore file

I found myself looking this up a few times and each time coming up with a slightly different variation, so here’s to saving the one I’m looking for. This will ignore all directories and files in the current directory except this .gitignore file. If you toss this in your bower_components directory and have third party code in there with their own .gitignore files, you won’t be prompted to version those :).

Save this in a .gitignore file


How to find modified files for an author with Git

The below command will display a list of files that have been added, modified, or renamed for the author you specify and the range of revisions you specify.

git diff --name-only --diff-filter=AMR --author="Nick Bartlett" 3f51381dbe085e2e4d5820ea7645f8bc26ca9232 HEAD