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

Git 子树合并声明已经是最新的

Git 子树合并声明已经是最新的,git,git-subtree,Git,Git Subtree,我没有太多的运气从子树中推/拉更改。通常我使用'git subtree'命令来创建子树并进行更改。当拉动时,我需要修复跛脚的冲突(当真的没有冲突时),而推动永远不起作用 所以今天我尝试一种不同的方法,使用子树合并而不是git subtree命令。我在办公室里按照指示做了 首先,我创建了要用作子树的存储库的远程数据库: git remote add -f cumulonimbus-machine http://github.com/fschwiet/cumulonimbus-machine git

我没有太多的运气从子树中推/拉更改。通常我使用'git subtree'命令来创建子树并进行更改。当拉动时,我需要修复跛脚的冲突(当真的没有冲突时),而推动永远不起作用

所以今天我尝试一种不同的方法,使用子树合并而不是git subtree命令。我在办公室里按照指示做了

首先,我创建了要用作子树的存储库的远程数据库:

git remote add -f cumulonimbus-machine http://github.com/fschwiet/cumulonimbus-machine
git merge -s ours --no-commit cumulonimbus-machine/old
git merge -s ours --no-commit cumulonimbus-machine/fschwiet
“old”分支是“fschwiet”分支的父级。最初我想将子树建立在'old'的基础上,以便测试拉取更改(拉取'fschwiet'的其余部分)。无论如何,我创建了子树:

git read-tree --prefix=host/ -u cumulonimbus-machine/old
这个很好用。所有文件都在hosts文件夹中,我可以像预期的那样在较旧的分支中看到它。然后我尝试获取一些更新:

git pull -s subtree cumulonimbus-machine fschwiet
我得到了一些令人失望的结果:

From http://github.com/fschwiet/cumulonimbus-machine
 * branch            fschwiet   -> FETCH_HEAD
Already up-to-date
我希望最后一次拉取将更新主机目录,使其具有来自“fschwiet”分支的最新版本。但它什么也没拉下来。我确实验证了'old'和'fschwiet'实际上不是同一个提交。我尝试了其他一些方法,结果都是一样的:

git subtree merge --prefix=host cumulonimbus-machine/fschwiet
git merge -X subtree=host cumulonimbus-machine/fschwiet
git subtree pull --prefix=host cumulonimbus-machine 90686ba2d0c31afdc516611064
git subtree pull --prefix=host cumulonimbus-machine master

我错过了什么?我的错误是跑步

git merge -s ours --no-commit cumulonimbus-machine/fschwiet
以前

git read-tree --prefix=host/ -u cumulonimbus-machine/old
这创建了一个合并提交,它拉入了“old”分支的内容,但告诉存储库它与“fschwiet”分支是同步的

尽管如此,我还是学到了一些有价值的东西。如果我使用

git merge -X subtree=host cumulonimbus-machine/fschwiet

而不是git merge-s子树或git子树merge。这似乎是一个更智能的合并算法。特别是,它删除了被删除的文件(与git子树合并不同)。

我的错误是在运行

git merge -s ours --no-commit cumulonimbus-machine/fschwiet
以前

git read-tree --prefix=host/ -u cumulonimbus-machine/old
这创建了一个合并提交,它拉入了“old”分支的内容,但告诉存储库它与“fschwiet”分支是同步的

尽管如此,我还是学到了一些有价值的东西。如果我使用

git merge -X subtree=host cumulonimbus-machine/fschwiet
而不是git merge-s子树或git子树merge。这似乎是一个更智能的合并算法。特别是,它删除了被删除的文件(与git子树合并不同)