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

还原后重新执行git子树拉取

还原后重新执行git子树拉取,git,merge,git-subtree,Git,Merge,Git Subtree,我有一个名为mainprepo的主回购协议和一个名为auxrepo的外部回购协议。 通常,我会将auxrepo的git子树拉入mainrepo中的目录,如下所示: 首先,我在mairepo中创建了一个名为aux update的新分支,然后: git remote add auxrepo git@git.example.com:example/auxrepo.git git subtree add --squash --prefix=lib/auxrepo auxrepo auxrepo-bran

我有一个名为
mainprepo
的主回购协议和一个名为
auxrepo
的外部回购协议。 通常,我会将
auxrepo
的git子树拉入
mainrepo
中的目录,如下所示:

首先,我在
mairepo
中创建了一个名为
aux update
的新分支,然后:

git remote add auxrepo git@git.example.com:example/auxrepo.git
git subtree add --squash --prefix=lib/auxrepo auxrepo auxrepo-branch
git subtree pull --squash --prefix=lib/auxrepo auxrepo auxrepo-branch
git commit
然后我将在
aux update
分支中合并到
mairepo

然而,昨天我从
auxrepo
中提取了一些错误的代码,并且不得不将更改还原到
mainprepo
。我是通过
git revert-m1$SHA
实现的,其中
$SHA
是来自
aux update
分支合并的SHA

现在,
auxrepo
已经用新的提交修复了,我想用子树拉再次拉入所有内容

问题是,当我只是简单地执行通常的
git子树pull--squash--prefix=lib/auxrepo auxrepo auxrepo分支时,它只会从今天开始获取新的提交,而不是恢复的旧提交

如何通过子树从
auxrepo
中提取所有提交,包括昨天的提交和今天的新提交?

试试看

git revert $REVERTED_SHA
git subtree pull -squash --prefix=lib/auxrepo auxrepo auxrepo-branch
其中,$REVERTED_SHA是您在执行git revert-m 1$SHA时创建的提交的SHA