1

Repository A)

MAIN ../repository_A/

../repository_A/some_directory/some_files

Repository B)

MAIN ../repository_B/

../repository_B/SRC/some_directory/some_files

The repository_B structure is identical to the repository_A structure, except for the /SRC/ directory which is in place because the main directory of repository_B has a .gitmodules file.

The ultimate goal is to clone/merge the content of /repository_B/SRC/ directory into /repository_A/ root - the folder structure is identical, so we need to write into existing folders of repository_A - for example write content of repository_B/SRC/includes directory into repository_A/includes.

Behind the task is that i have a modular system which is repository_A that is extended through modules which are represented by repository_B.

Another option that would do the job too would be to mv repository_A into another directory so that the folder structure is identical to repository_B.

1 Answers1

0

You won't need to git clone, but you will need a git merge.

  1. I would match repository A's folder structure to repository B, i.e. create /SRC/ folder to match repository B.
  2. git commit/push repository's A's new structure.
  3. If you want to merge repository B into repository A:

    cd path/to/repo-A
    git remote add repo-a path/to/repo-B
    git fetch repo-B
    git merge repo-B/master # or whichever branch you want to merge
    git remote remove repo-B
    

Reference: How do you merge two Git repositories?

Community
  • 1
  • 1
jojo
  • 1,135
  • 1
  • 15
  • 35
  • Great - is there anything todo to track repo_B? –  Nov 17 '15 at 20:57
  • 1
    If you want, create a tag of where you merged in repo_B like so: `git tag v1.0` then push your tags `git push origin --tags`. – jojo Nov 17 '15 at 22:00