Git将远程存储库项目合并到当前存储库项目的子目录

时间:2018-12-10 11:04:38

标签: git

我需要将一个项目中的特定分支合并到当前正在运行的另一个项目中的另一个分支中。我正在按照以下步骤进行操作

  1. In Source Repo-A: v23-branch, I created a local temp branch and 
moved all the contents to a folder and made a local commit.    
  2. Then In Target Repo-B, I added the local git path like given below.
     git remote add tmpmerge <local url of Source Repo-A: v23-branch>
  3. Then did a fetch to get the branch details of Source Repo-A.         
     git fetch of tmpmerge          
  4. Merge both branches with history
      git merge tmpmerge/temp --allow-unrelated-histories
I get so many merge conflicts as describe in the bottom.

下面是我期望实现的树结构

Source Repo-A: v23-branch
   module1
   module2
   pom.xml
   Dockerfile

Target Repo B: some-branch
   source Repo-A: v21-branch
   |-module1
   |-module2
   |-pom.xml
   |-Dockerfile
   Repo-B-Files1
   Repo-B-Files2
   Repo-B-Files3
   pom.xml
   Jenkinsfile
   Dockerfile

What I want to achieve is given below.

Target Repo B: some-branch 
source Repo-A: v21-branch
|-source Repo-A: v23-branch
  |-module1
  |-module2
  |-pom.xml
  |-Dockerfile
|-module1 
|-module2 
|-pom.xml 
|-Dockerfile 
Repo-B-Files1
Repo-B-Files2
Repo-B-Files3
pom.xml
Jenkinsfile
Dockerfile

我想按上述结构将源repo模块合并到目标模块,因为在将内容合并为父目录时会覆盖当前项目中可用的一些现有文件,如pom.xml,docker file等。而不是合并到当前项目父目录我想将其所有日志和历史记录写为子目录。但是我面临模块文件的CONFLICT(重命名/删除),CONFLICT(重命名/重命名)...在此先感谢

0 个答案:

没有答案