简体   繁体   中英

Merge a Git repository with a sub directory of remote Git

I have a Git repository and everything is on root, but on remote git repository the desired content is one level deep (there are three types of folder 1-git folders 2-DemoProject 3.some-other-folder-i-have-no-concern). How to merge these two together. Even though they are completely disconnected but i have found the way to merge the disconnected repository but this level thing isn't working.

LocalBranch(DemoProject)
     -(git folders)
     -Content1
     -Content2

Remote Branch
      -(git folders)  
      -DemoProject
         -Content1
         -Content2
       -Some Folder

One way would to:

  • clone the remote repo
  • reorganize (in a dedicated branch) its content in order to reflect your own repo
  • push that dedicated branch

Then, following " How to combine two separate unrelated Git repositories into one with single history timeline ", you can combine the history of your repo on top of the remote repo (which, on that special branch, contains the right structure).

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