Sato
Sato

Reputation: 8592

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

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?

Upvotes: 7

Views: 4843

Answers (1)

cfi
cfi

Reputation: 11290

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

  1. Clone the orig repo,
  2. git mv all stuff into a new subdir AA.
  3. Then use that as the source repo to clone from with this answer from this question.

Upvotes: 3

Related Questions