Eclipse: Ignore certain files in project such as .git and .svn

For some time, the only way to ignore certain file types in Eclipse was to create a plugin.

Resource filters were added recently (apparently in 3.6 Helios) and I had only discovered them recently.

They solve one of the biggest gripes I've had with Eclipse so far. The ability to ignore any file matching a pattern (such as compile .pyc python files, MacOSX .DS_Store or thumbs.db).

It can also extend to folder paths so we can ignore those pesky .git or .svn folders and all of the unnecessary files within them.


Enough complaining, more removing!

For this example, I'll be showing how to hide all .git folders and their contents. This can be substituted for .svn.

  1. First step, open your project.
  2. Right click, Properties
  3. Expand Resources and click onto Resource Filters
  4. Click "Add"
  5. Use these settings

Filter type: Exclude all.

Applies to: Folders

Click "All children (recursive)" as any subfolders containing your pattern will still show up (common case for .git and .svn)

File and folder attributes: Name matches .git

OK to save!

Click Apply when ready.


Eclipse will now refresh and rebuild the project.

If you're ignoring file names, use the following settings instead.

Applies to: Files

Matches: *.pyc (or .DS_Store, thumbs.db, etc)

No need for all children.

Great feature, very flexible but pain in the ass if you've got 15 projects...

Very much worth setting up if you're working over a remote connection, it saves a LOT of time refreshing your project even if it's a LAN connection.

Happy times!


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog