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

Git 更新其他项目的子树

Git 更新其他项目的子树,git,git-merge,git-subtree,Git,Git Merge,Git Subtree,在我的项目中,我使用了在/Libs文件夹中分组的几个库(相对于项目树的根)。我想在我的项目中使用库。但我不喜欢导入整个库的repo,因为它包含很多不必要的东西——文档、示例、工具等等。我只想导入一个“src”文件夹。还有一件更重要的事:我想使用子树,而不是子回购 我做了什么(其中一个库是我想要使用的库的名称): 到目前为止还不错。使用这些命令,我提取了一个_lib源代码,将“src”目录从库源代码树提取到一个单独的分支中。最后,我添加了库的'src'文件夹作为我的主项目的Libs/a_lib目录

在我的项目中,我使用了在/Libs文件夹中分组的几个库(相对于项目树的根)。我想在我的项目中使用库。但我不喜欢导入整个库的repo,因为它包含很多不必要的东西——文档、示例、工具等等。我只想导入一个“src”文件夹。还有一件更重要的事:我想使用子树,而不是子回购

我做了什么(其中一个库是我想要使用的库的名称):

到目前为止还不错。使用这些命令,我提取了一个_lib源代码,将“src”目录从库源代码树提取到一个单独的分支中。最后,我添加了库的'src'文件夹作为我的主项目的Libs/a_lib目录

自从我将库导入到我的项目中以来,库已经更新。我想提取新的更改,并将它们与我在库代码中所做的更改合并

我尝试了这些命令(在其他计算机上执行这些命令,因此重复一些步骤)

最后一个命令因此输出失败

fatal: ambiguous argument '62d6171eb30af14351671c483f4e0a233df24e20^0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
could not rev-parse split hash 62d6171eb30af14351671c483f4e0a233df24e20 from commit 66375945cbe689c6864d3a0adba53bdbe0c0f86c
Can't squash-merge: 'Libs/a_lib' was never added.
fatal:不明确的参数“62d6171eb30af14351671c483f4e0a233df24e20^0”:未知修订或路径不在工作树中。
使用“---”将路径与修订分开,如下所示:
'吉特[…]-[…]'
无法从提交66375945CBE689C6864D3A0ADBA53BDBE0F86C中重新解析拆分哈希62d6171eb30af14351671c483f4e0a233df24e20
无法挤压合并:从未添加“Libs/a_lib”。
我对git很陌生,所以我自己也不知道这里出了什么问题。有人能帮我合并库更改吗

git remote add a_lib https://github.com/xxx/a_lib.git
git fetch a_lib
git checkout -b dependencies/a_lib a_lib/master
git subtree split --prefix=src --annotate="[a_lib] " --rejoin -b subtrees/a_lib
git checkout master
git subtree merge --prefix=Libs/STM32generic --squash subtrees/stm32generic
fatal: ambiguous argument '62d6171eb30af14351671c483f4e0a233df24e20^0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
could not rev-parse split hash 62d6171eb30af14351671c483f4e0a233df24e20 from commit 66375945cbe689c6864d3a0adba53bdbe0c0f86c
Can't squash-merge: 'Libs/a_lib' was never added.