Search code examples
eclipsegitmavenegitgit-worktree

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.


Solution

  • tl;dr As of March 2021 April 2023, 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 :-).