Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Git worktrees with Eclipse IDE?

I am moving a large application from SVN to Git while only having read "pro Git" and some worktree details online and played around with Git.

I created a single repository that manages the code of my application. My application consits of a lot of different Eclipse projects that are of Maven nature and are released separately. I created a remote branch for every Eclipse project, as suggested. Now I want to checkout some of those Eclipse projects in parallel, at newly created individual feature branches, to implement a new application feature that affects more than one Eclipse project.

Here, on 28.08.2019, Andre Bossert stated that Eclipse is able to detect and support Git worktree directories. But I just fail to hit the right button in Eclipse, it seems. Can anybody point to a documentation of Eclipse egit where I can find further information, please? I also failed to find this information by myself.

like image 213
Martin Avatar asked Dec 19 '19 09:12

Martin


People also ask

How do I connect to a remote Git repository in Eclipse?

Go to the "Git Repositories" view, open the tree of the repository you want, right-click on "Remotes" and select "Create Remote". Remote name is the alias, and the url is specified in the second step of the wizard.

How do I pull a Git repository in Eclipse?

Open Eclipse and choose Import –> Projects from Git (with smart import) Choose the Clone URI option in the Git import wizard and click Next. Confirm the URI, Host and Repository path parameters and click Next. Choose the Git branches to clone from the remote repository and click Next.

How do I access GitHub from Eclipse?

Loading an existing project from github to Eclipse: 1. For your partner to download the project, they need to click Window → Show View → Other → Git → Git repositories. Then select “Clone a git repository and add it to this view”.


1 Answers

tl;dr As of March 2021, the Eclipse IDE does not support Git worktrees.


Longer answer:

Unfortunately, the Eclipse IDE as shipped by the Eclipse foundation does not support the worktrees created by git-worktree.

There is an open bug for this - Bug 477475 - git 2.5 worktree support. The bug was reported in 2015 and is still open.

There has been quite a bit of work on the problem, and a (mostly?) working implementation exists, as discussed in the bug and in the linked Gerrit changes, but that code has not made it into any release so far.

As of March 2021, the latest work seems to be the Gerrit change 163940: Add git-worktree support for already created worktrees, last updated December 2020. So we can only wait and see... or help with coding :-).

like image 50
sleske Avatar answered Oct 18 '22 20:10

sleske