'Git submodule in existing directory - or alternative

I am trying to include some folders from a repo, to another repo. Both repo could not be merged into one and are maintained separately.

Here is what I have:

RepoA
--A1
--A2

RepoB
--B1
--B2

What I need:

RepoB
--B1
--B2
--A1
--A2

What I tried:

git.exe submodule add -b RepoABranch -- "repoA.git" "pathToRepoB"

The error I get:

'pathToRepoB' already exists in the index

So I tried:

git.exe submodule add -b RepoABranch -- "repoA.git" "pathToRepoB/test"

And this works fine, as it is the espected behavior. So I get:

RepoB
--B1
--B2
--test--A1
--test--A2

The issue here is that I cannot work with an "intermediate" directory. All the files shoulde be in the same directory.

Is there a way to include the RepoA in repoB without the need to create another directory (here "test") ?

If it is not possible with submodule, do you see another way of doing that ?

Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source