Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.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_Git Merge_Git Pull - Fatal编程技术网

Git 如何在我的项目的子目录中合并远程回购?

Git 如何在我的项目的子目录中合并远程回购?,git,github,git-merge,git-pull,Git,Github,Git Merge,Git Pull,我想合并项目子目录中的远程回购。几天前,我将这个远程项目作为子目录手动复制到我的项目中,并对其进行了修改。现在有了它的新版本,我想在不丢失修改的情况下合并子目录中的新更改 结构: myProject /mySubproject1 /mySubproject2 <-- This one is the modified remote repo (from Github) 但我得到了以下信息 错误:条目“mySubproject2/.something.yml”与 “mySu

我想合并项目子目录中的远程回购。几天前,我将这个远程项目作为子目录手动复制到我的项目中,并对其进行了修改。现在有了它的新版本,我想在不丢失修改的情况下合并子目录中的新更改

结构:

myProject
    /mySubproject1
    /mySubproject2  <-- This one is the modified remote repo (from Github)
但我得到了以下信息

错误:条目“mySubproject2/.something.yml”与 “mySubproject2/.something.yml”。无法绑定


有可能是我想要的吗?你知道怎么解决吗?

我没有使用有时有点混乱的子模块,而是使用了子树。子树将是我要添加到“父”项目中的项目:

这里是一个例子,我们想在我们的项目中添加来自Github的nodejs-y-express项目

将子树添加到我们的项目中

$ git subtree add --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master 
git fetch https://github.com/codeheroco/nodejs-y-express-rutas master
从github更新项目

git subtree pull --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master

我没有使用有时有点凌乱的子模块,而是使用了子树。子树将是我要添加到“父”项目中的项目:

这里是一个例子,我们想在我们的项目中添加来自Github的nodejs-y-express项目

将子树添加到我们的项目中

$ git subtree add --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master 
git fetch https://github.com/codeheroco/nodejs-y-express-rutas master
从github更新项目

git subtree pull --prefix node_express_subtree https://github.com/codeheroco/nodejs-y-express-rutas master

如果您想在项目中包含此项目,并且希望使其保持最新,您可能需要阅读“git子模块”。@larsks我可以修改项目吗?当我更新项目时,我可以维护修改吗?@iker您可以维护一个从上游提取并维护更改的分叉。因此,理想情况下,您需要一个单独的repo。子模块只是一个git存储库…所以,当然。如果您希望在项目中包含此项目,并且希望使其保持最新,您可能需要阅读“git子模块”。@larsks我可以修改项目吗?当我更新项目时,我可以维护修改吗?@iker您可以维护一个从上游拉动并维护更改的分叉。所以,理想情况下,您需要一个单独的repo。子模块只是一个git存储库……所以,当然。