goops is a command line tool that adds a .gitignore file to your current working directory. It's a little more helpful than that though, goops will analyze the files in your directory and determine the best .gitignore for your project based on a simple heuristic or offer you a list of potential .gitignore files to choose from.
npm install --global goops