如何将一个git仓库移至另一个仓库时解决冲突

问题描述 投票:0回答:1

我有两个存储库repo-A和repo-B。我想将repo-A移到repo-B作为子文件夹。我通过以下this在repo-B中进行了以下操作:

git remote add repo-A url-to-repo-A
git fetch repo-A --tags
git merge --allow-unrelated-histories repo-A/master

但是,出现以下错误:

Auto-merging package.json
CONFLICT (add/add): Merge conflict in package.json
Auto-merging package-lock.json
CONFLICT (add/add): Merge conflict in package-lock.json
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.

我该如何解决?

git repository git-merge
1个回答
0
投票

打开具有头和尾部分的文件,手动选择要保留的文件,然后保存文件。

这些文件具有相同的名称,但内容不同,因此您的软件不知道该如何处理,这就是为什么您手动检查要保留的部分。使用gitkraken或其他工具可以使此操作变得容易得多,因为它们可以显示出不同的行,并且显示效果很好。

© www.soinside.com 2019 - 2024. All rights reserved.