What of Eclipse project .metadata can I safely ignore in Git/Mercurial?

Irish Buffer picture Irish Buffer · Nov 25, 2010 · Viewed 45.2k times · Source

We have the code for an Eclipse RCP application in an Eclipse workspace containing multiple Java projects. We are using Mercurial with a simple .hgignore just *.class (but the same issue would pertain to Git).

Even a small change to the code can result in many of the files in .metadata getting changed.

I'd like to exclude some or all of the .metadata from version control. If we exclude it completely, the workspace is lost.

Does anyone know what we can safely exclude? Alternatively, how can we recreate it if we pull the code down to a fresh computer?

Answer

Adam Vandenberg picture Adam Vandenberg · Nov 25, 2010

GitHub is maintaining a community "gitignore" project that catalogs suggested filespecs for ignores for various platforms, editors and languages: https://github.com/github/gitignore

Eclipse ignores are here: https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore

(If there are other filespecs that they should know about, let them know!)