Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Migrate Git Projects to Be One Project with Subprojects
    primarykey
    data
    text
    <p>I have a number of projects that are in separate Git repositories right now. They are, likewise, in separate eclipse projects (because I was unable to use parent projects using the Maven plugin for a long time due to bugs in the m2 plugin). Now that works. </p> <p>So I combined the projects in Maven, making a base pom project, adding that as the parent to the others. Then I nested the subprojects.</p> <p>When I went to commit the base project as a git project, it had decided that the subdirectories were submodules, even though there was no .gitmodules file in the root directory. </p> <p>Looks like the only way to get this done would be to lose all the history in the projects that are being combined.</p> <p>Just to be super clear, current have:</p> <pre><code>Project A (repo A) Project B (repo B) Project C (repo C) </code></pre> <p>what I want is:</p> <pre><code>New Base Project D (repo D) /Project A /Project B /Project C </code></pre> <p>I would rather not lose any history but if I have to, I guess I could attic the prior versions. I don't think I want submodules, as those seem to be geared towards including remote repos that are not under your control.</p> <p>Turned the solution into a bash script. It assumes that the subs you want to add are in subdirectories on the same level with the parent. Here it is:</p> <pre><code>#! /bin/bash git remote add -f $1 ../$1 git merge -s ours --no-commit $1/master git read-tree --prefix=$1 -u $1/master git commit -m "Added project $1" </code></pre> <p>Git is amazing..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload