Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Structuring an eclipse project containing multiple git repositories

I'm using Eclipse CDT and egit and I need to construct a single project from multiple repositories. One contains the main body of the source code and the other contains utility scripts used as part of the build process (which are also used when building several other projects).

I'm struggling to understand if I can make egit work sensibly with this setup. I can't work out how to associate a CDT project with more than one git repository and that means that I can't perform VCS operations for some of the files in the project.

I'd like to be able to right click on any file in the workspace and have egit work out which repository it is in and so perform operations (history, blame...) correctly. Has anybody managed to do this or can you point me at documentation I can't find because of the huge number of "Multiple projects in a single repo" guides.

like image 618
Carcophan Avatar asked Apr 10 '26 07:04

Carcophan


1 Answers

EGit can only have 1 repository associated with a project, and the project needs to be inside that repository. For example, the following are valid layouts.

On the same level as the project:

.git
.project
src
...

Containing more than one project:

.git
project-a
    .project
project-b
    project

It's not possible to have something like this and have EGit know about the repository for this project:

.project
foo
    .git

The above would also mean that project files (.project, .classpath, etc) are not in the repository – and they should be.

So I recommend having multiple projects, one (or more than one) for each repository.

like image 129
robinst Avatar answered Apr 12 '26 20:04

robinst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!