Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How to manage multiple projects within the same repo(With independent branch switching)
How to manage multiple projects within the same repo [message #1849692] Sun, 30 January 2022 00:07 Go to next message
Jack McKalling is currently offline Jack McKallingFriend
Messages: 6
Registered: January 2022
Location: Dreamland
Junior Member
What is the most common way of managing multiple projects within the same repo? For instance if you start each project on its own root commit, would that allow you to switch branches on each project independently from the other?

And how do you setup a root commit in the first place? Or alternatively if that's not the way, how would I go about creating the second project for this repo, normally?

Currently I have setup my second project from the non-git new project wizard, shared it by specifying the existing repo, and committed this onto a new branch based off the master branch of the first project. But I now have other branches in front of the master for the first project too, and each time I switch branches, the second project "disappears" completely from the package explorer.

I'm guessing this is because the second project is dependent on the current branch of the first project this way, and since it doesn't exist on some of the branches it gets automatically removed by git if I switch. But I want to be able to freely switch branches between the two projects as if they were from different repos. Or, that's my naive wish if that's what it is. I've just started using EGit this month so what do I know.

I've read most of the EGit User Guide, and I couldn't find specific instructions on how to manage multiple projects per repo, but it does suggest that it should be possible considering the folder structure of Repo > project > working tree.

[Updated on: Sun, 30 January 2022 08:47]

Report message to a moderator

Re: How to manage multiple projects within the same repo [message #1849697 is a reply to message #1849692] Sun, 30 January 2022 10:00 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1212
Registered: July 2009
Senior Member
The straight forward way to version two projects independently is to put them in different git repositories.
You can have multiple independent version graphs in a single repository by adding multiple orphan commits having no parent.

Though you can checkout only a single version of a repository at the same time per working tree. Git supports multiple
working trees [1] for a repository, support for that in jgit/egit is still a work in progress [2].
Another way to achieve the same is to clone the same repository twice.

[1] https://git-scm.com/docs/git-worktree
[2] https://git.eclipse.org/r/q/topic:%22worktree%22+(status:open%20OR%20status:merged)
Re: How to manage multiple projects within the same repo [message #1849698 is a reply to message #1849697] Sun, 30 January 2022 10:31 Go to previous message
Jack McKalling is currently offline Jack McKallingFriend
Messages: 6
Registered: January 2022
Location: Dreamland
Junior Member
Ah, I see. Thanks so much! I think I'll try cloning multiple times then. Because I want to observe the two projects at the same time, although they're closely related and might even share (duplicate) some files.

But in theory, how does having multiple orphan commits (root commits) work if you switch branches? This is what my head can't get around yet, as it looks to me that having independent orphans would mean both could checkout independently? I don't understand. I couldn't test this because I don't know how to properly create such an orphan, it kept associating the other project.
Previous Topic:Git clone of a source code into a parent C project doesn't appear to work?
Next Topic:[Feature request] Show commit message in Revision Information
Goto Forum:
  


Current Time: Mon Sep 26 03:26:47 GMT 2022

Powered by FUDForum. Page generated in 0.01765 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top