Which files should be versioned under git?


I was wondering which files should be versioned for my Java application?
So far I’ve done this empirically. I versions src/ and launcher/. What about other files such as .classpath, .settings/, etc.


Hi Medhi,

For a Java application, you should version src/ and the .launch. In the launch/ folder, do not version the launch/*.properties as they are generated when the configuration runs.
If you do use properties for your launcher:

  • put them in a different file (e.g. common.properties)
  • include the file in the launcher (in the Execution tab in Option files panel)
  • commit the property file and the launcher configuration

The following files and folders should be ignored:

  • bin/
  • ~target/
  • src-adpgenerated/ (generated by the JUnit addon)

For Eclipse related files, you should follow Eclipse’s recommandations. Keep the following under version control:

  • .project
  • .classpath

For the .settings/ it is up to you to decide whether the settings should be shared between you and your team. It is often better to version it, but can led to conflicts between developers from time to time.


1 Like