Rozen
Rozen

Reputation: 139

git and eclipse workbench

I'm totally new to git and have a question related to the work bench. I do stuffs in java so I would ask in term of java. When you commit files to git repository, do we commit .java, .class files? Or it is ok to put the whole work bench into the local git folder then commit everything?

Upvotes: 1

Views: 48

Answers (1)

Timo Geusch
Timo Geusch

Reputation: 24351

It's generally not considered a good idea to commit binary files to any version control system if you can recreate them by simply compiling the source code you also committed. This is especially important with a DVCS as every copy of the repository carries around the redundant data. This might not be a big deal if you're working on a fairly small project, but once the project gets bigger it's a nuisance.

The other problem with committing the .class files or any sort of binary is that any sort of build will show your source tree as "dirty" in multiple places unnecessarily as both the class files and the java files will need comitting.

My advice would be to put the build directories in your projects in .gitignore so git knows not to look at them, then add your source files and the Eclipse project files to git.

Upvotes: 2

Related Questions