Populate .gitignore Automatically with git-ignore

Tired of having to create your .gitignore manually?


Like, having to add .DS_Store, Thumbs.db, *.swp, *.swo, *.swn, node_modules?

I stumbled upon this project called git-ignore.

Well, enough talking, let’s install it. See their installation directions. Here’s a command for Mac OS X.

brew install https://raw.github.com/imwithye/git-ignore/master/git-ignore.rb

Now at my project, I typed:

git ignore add osx node vim

Now it says:

add gitignore file from /usr/local/Cellar/git-ignore/0.2/include/github-templates/Global/OSX.gitignore
add gitignore file from /usr/local/Cellar/git-ignore/0.2/include/github-templates/Node.gitignore
add gitignore file from /usr/local/Cellar/git-ignore/0.2/include/github-templates/Global/vim.gitignore

Now my .gitignore is populated with ignore rules for:

  • Common Mac OS X files (.DS_Store, …)
  • Node.js projects (node_modules, lib-cov, .grunt, …)
  • Vim (*.swp, .netrwhist, …)

It is a very handy tool, and deserves more stars. So star it to help get into official Homebrew repository! imwithye/git-ignore.