Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 吉特:合并两个回购协议,历史有冲突_Git_Github_Merge_Git Am - Fatal编程技术网

Git 吉特:合并两个回购协议,历史有冲突

Git 吉特:合并两个回购协议,历史有冲突,git,github,merge,git-am,Git,Github,Merge,Git Am,11月,我克隆了该项目,并在50次承诺之前创建了一个新的回购协议,这意味着: A----B----C----D----E Cloned New Repo from C \__ C 现在,在新的repo中大约有15-20个提交,但是没有提交被推送到旧的repo,而是在编码许多文件和内部更改时 A----B----C----D----E Cloned New Repo from C \__ C----C1----C

11月,我克隆了该项目,并在50次承诺之前创建了一个新的回购协议,这意味着:

A----B----C----D----E
          Cloned New Repo from C
           \__ C
现在,在新的repo中大约有15-20个提交,但是没有提交被推送到旧的repo,而是在编码许多文件和内部更改时

A----B----C----D----E
          Cloned New Repo from C
           \__ C----C1----C2---C3---C4
现在我想将这两个回购合并为一个:

A----B----C----D----E----C1----C2---C3---C4
搜索internet后,收到一些命令并尝试与以下内容合并:

 git --git-dir=../<some directory>/.git|
    format-patch -k -15 --ignore-space-at-eol --stdout <commit SHA>|
    git am -k -3
显示一个错误:

Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0002 XXXXXXX
The copy of the patch that failed is found in:
   /xxxxxx/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
如果可能,如何解决此问题?
还有其他解决这个问题的方法吗?我会避免“am”方法——如果你确实有共同的历史,你应该利用rebase、merge或cherry

假设您在E有一个名为“master”的分支

将第二个存储库作为远程存储库添加到第一个存储库。假设我将新的远程设备命名为“沙盒”

全取


现在在sandbox/C4创建一个新的本地分支。。假设分支名为“otherwork”。检查该分支并在“主”顶部重新设置基础。如果您在解决任何问题时遇到困难,您可以查看master和Cherry,从“otherwork”分支一次选择一个更改。

感谢您提供的精彩建议,在一次提交中解决了所有问题
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0002 XXXXXXX
The copy of the patch that failed is found in:
   /xxxxxx/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".