How to add one git repository into another git repository's sub-folder?

git

Solution

If folder structure is different a `git mv` would solve that:

- Clone the orig repo,

- `git mv` all stuff into a new subdir `AA`.

- Then use that as the source repo to clone from with this answer from this question.

Problem

I have one GIT repository in a folder called AA, and I have second GIT repository called BB. I want to import the AA repository into the BB repository as a sub folder. before: ``` AA |- .git |- A/ |- fileA BB |- .git |- B/ |- fileB ``` after: ``` BB |- .git # new .git with both AA and BB .git infos |- B/ |- fileB |- AA/ # <== no .git anymore |- AA/A/ |- AA/fileA ``` How can I do that?

Original source

Related problems