简体   繁体   English

合并Git存储库和远程Git的子目录

[英]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). 我有一个Git信息库,所有内容都在根目录上,但是在远程git信息库中,所需的内容深一层(存在三种类型的文件夹1-git文件夹2-DemoProject 3.some-other-folder-i-have-no -关心)。 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). 然后,按照“ 如何使用单个历史时间线将两个独立的不相关的Git存储库合并为一个存储库 ”,您可以在远程存储库(在该特殊分支上,包含正确的结构)上合并存储库的历史记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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