【发布时间】:2015-06-23 21:10:34
【问题描述】:
我没有太多运气从子树中推送/拉取更改。通常我使用“git subtree”命令来创建子树并拉取更改。拉动时,我需要解决蹩脚的冲突(当确实没有冲突时),而推动永远不起作用。
所以今天我尝试了一种不同的方法,使用子树合并而不是 git subtree 命令。我按照https://help.github.com/articles/about-git-subtree-merges/ 的说明进行操作。
首先,我创建要用作子树的存储库的远程:
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
“旧”分支是“fschwiet”分支的父级。我最初想将子树建立在“旧”的基础上,这样我就可以测试拉动更改(拉动“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”分支的最新信息。但它并没有拉倒任何东西。我确实验证了“旧”和“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 git-subtree