Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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存储库时的冲突_Git_Repository_Git Merge - Fatal编程技术网

如何解决将一个git存储库移动到另一个git存储库时的冲突

如何解决将一个git存储库移动到另一个git存储库时的冲突,git,repository,git-merge,Git,Repository,Git Merge,我有两个存储库repo-A和repo-B。我想将repo-A作为子文件夹移动到repo-B中。我的问题与可能重复的答案不同!请不要不假思索地做标记。我在repo-B中做了以下工作: 但是,我得到了以下错误: Auto-merging package.json CONFLICT (add/add): Merge conflict in package.json Auto-merging package-lock.json CONFLICT (add/add): Merge conflict in

我有两个存储库repo-A和repo-B。我想将repo-A作为子文件夹移动到repo-B中。我的问题与可能重复的答案不同!请不要不假思索地做标记。我在repo-B中做了以下工作:

但是,我得到了以下错误:

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.

如何解决这个问题?

问题:两个存储库A和B中的文件应该是相同的文件吗?还是希望将中的所有文件添加为子目录并作为单独的文件保存

解决方案1:是的,它们是相同的文件,需要合并这些文件。 在这种情况下,您需要编辑文件以解决任何冲突。冲突标记>将添加到文件中。您需要编辑文件,使其包含合并后所需的内容。然后执行:

git add <file>
# after all file conflicts have been resolved and added
git commit
可能重复的
git add <file>
# after all file conflicts have been resolved and added
git commit
git subtree add -P <prefix> <repository> <ref>
git subtree add -P repo-A-dir url-to-repo-A master