I often find myself having to fiddle about with ignore settings in various IDEs, so I thought I’d put together a simple general purpose solution that will ignore all the usual suspects for Intellij and Eclipse within a Maven reactor build (even works on a Mac).

Here it is:

# Eclipse
.classpath
.project
.settings/

# Intellij
.idea/
*.iml
*.iws

# Mac
.DS_Store

# Maven
log/
target/

If you place this in .gitignore the root directory of your project, the ignore settings will be applied to all sub-directories automatically.

Finally, no more accidental commits of /target into the repo.

You may also want know how to purge the commit history to get rid of those old bloating commits, or perhaps an accidental commit of a password. If so the GitHub people have written an excellent tutorial.