简体   繁体   中英

Migrate projects from existing Git repo to restructured Git repo

I have multiple projects in a Git repo as shown below

ProjA
 |- file1
 |- dir1/file2
 |-dir2/file3

ProjB
 |- fileA
 |-dirB/file4

I need to migrate those projects to a new Git repo, which should have the following structure:

 NewProj
  |-- ProjA --| -file1
              |-file2
              |- file3
  |--ProjB --|-file4
             |--NewDir/fileA

Any help will be appreciated.

First of all, simple move the files in both projects ProjA and ProjB to their final destination. git should be able to detect those changes. Maybe this link is of help. If you have a remote repository, push it.

Afterwards, create a new repository in an empty folder

git init NewProj

Add the two previous projects as submodules to your new repository:

git submodule add <<path to repo>>

Done. You can find some information about submodules here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM