1
votes

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?

1
Assuming that you use EGit, do you have the preference Team > Git > Projects > Track each branch's projects enabled? - RĂ¼diger Herrmann
your projects become stale because they probably don't exist in that branch. If you switch back to the newer branch, the projects become active again. - flavio.donze

1 Answers

0
votes

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.