One-liner to add .gitignore to all sub-directories

Git tracks files, not folders. So if you have a project with empty folders they won’t come with the repo when you clone a project. Run this in terminal to add a .gitignore file to all sub-directories of a project:

$ find . -type d -empty -exec touch {}/.gitignore \;