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:

  • Is there any IDE/GUI support for git-flow on Windows/Linux?
  • .gitignore file for java eclipse project
  • How to revert changes due to a merge with Eclipse and EGit
  • Why is EGit showing unstaged changes in a freshly cloned repository?
  • Migrating SVN to Android Studio
  • How do I use Eclipse Refactoring Tools and stay in sync with SVN through Subclipse?
    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!

  • Git not detection new added file
  • Does NPM ignore files listed in .gitignore?
  • In XCode 4 how do I add a remote GitHub repository to an existing local project?
  • Git/gitk shows me unknown/invalid sha1 id for a folder but not from its parent folder.
  • Can TortoiseHg, TortoiseGit and Git Extensions Peacefully Coexist?
  • Github and SVN Workflow
  • One Solution collect form web for “Egit working directory vs. projects in Eclipse”

    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.

    Git Baby is a git and github fan, let's start git clone.