Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Egit working directory vs. projects in Eclipse

I'm a long time Eclipse user but new to Git/Egit. Recently I've been trying to use Egit because I want to use GitHub to collaborate with a number of projects. The projects I want to work on are not Eclipse-specific projects but I'd still like to set up a workflow so that I can work on them in Eclipse.

It seems that there are a number of things that need to fit together:

  1. The remote repository (on GitHub)
  2. The local repository (somewhere on my filesystem)
  3. The Git working directory
  4. The Eclipse project that I want to work in (including stuff outside the source tree like Eclipse project files, Maven config, build folders etc.)

How do these relate to each other and what should be my workflow?

In particular:

  • Do I actually need a local repository or can I just work directly with the remote repository (like with SVN)?
  • Can the Git working directory also be the Eclipse project? Or is this a bad idea?
  • What should my workflow of push/pull/fetch etc. normally be?
  • If I use Maven for dependency management in the Eclipse project, but don't want all the Maven-specific stuff to get committed to SCM, can this work?

Guess I'm loking for some sound advice from someone who's successfully made this work!

like image 930
mikera Avatar asked Aug 07 '11 14:08

mikera


1 Answers

Do I actually need a local repository or can I just work directly with the remote repository (like with SVN)?

Git is all about working on a local repository and pushing elsewhere when necessary.

Can the Git working directory also be the Eclipse project? Or is this a bad idea?

If it lines up this way, then yes. This is how I've managed my projects.

What should my workflow of push/pull/fetch etc. normally be?

You push when you feel you have made enough commits (sometimes only 1) that are worth pushing. You pull when you want to work with changes that other people have pushed.

See gitworkflows for the official doc on different types of workflows.

If I use Maven for dependency management in the Eclipse project, but don't want all the Maven-specific stuff to get committed to SCM, can this work?

Usually you just commit the pom.xml. Anything else is a user specific setting. Although, if I clone your repository and can't do a "mvn compile", then there's something wrong.

like image 140
Jeremy Avatar answered Sep 23 '22 15:09

Jeremy