Developing an application with multiple Eclipse projects using Git?

I have an Eclipse RCP application with many plugins (hence, many Eclipse projects) that are version-controlled in one Git repository. I cloned the repository to one directory and set up the Eclipse workspace in another directory, according to the recommendations for using EGit. The projects have been imported using File > Import > Git > Projects from Git

My problem is that development is taking place on multiple branches, and the set of plugins/Eclipse projects is different depending on the branch. When I switch to an older branch with less plugins, some of the workspace projects become stale.

I could create one development workspace for each branch, but then I would have to take care that the branch that is currently checked out is always matching the Eclipse workspace that is open.

Is there any best practice for this?

One Solution collect form web for “Developing an application with multiple Eclipse projects using Git?”

If switching the branches in one workspace is a problem, another not so nice solution could be, checking out the repository in each workspace and switching to the according branch.

branch1-workspace/git-repository # switch to branch1
branch2-workspace/git-repository # switch to branch2
branch3-workspace/git-repository # switch to branch3

or setting up a repository folder and checking out different branches

repositories/branch1/git-repository # switch to branch1
repositories/branch2/git-repository # switch to branch2
repositories/branch3/git-repository # switch to branch3

where git-repository is your repository.

In your workspace you will need to import the projects from there:
Import -> Existing Projects into Workspace
Eclipse will know that those projects are connected to a Git repository.

Or adding the repository through the “Git Repositories” view:
“Add an existing local Git Repository to this view”
And import the projects from there.

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