简体   繁体   English

使用Git如何从远程分支合并子树

[英]Using Git how to merge a subtree from remote branch

Subtrees in Git work nicely although some git commands remain to be supported for subtrees. 尽管仍然有一些git命令支持子树,但是Git中的子树可以很好地工作。

Here's the question: 这是问题:

How to make the subtree pull from a different remote branch like "stable" or "integrate"? 如何使子树从不同的远程分支(如“稳定”或“集成”)中拉出?


FYI, we have a subtree "push" working as a script. 仅供参考,我们有一个subtree "push"作为脚本。 In fact, it can even push the subtree to the specific branch of our choice on the remote repository. 实际上,它甚至可以将子树推送到远程存储库上我们选择的特定分支。

Does anybody know how to do the reverse on a pull or even have a clue? 有人知道如何一拉到底,甚至有一个线索吗?

The simple pull works like this: 简单的拉动如下所示:

git pull -s subtree remotebranch

One idea that can be tried: Maybe a 2-step process will do the trick. 可以尝试的一个想法:可能需要两步过程才能解决问题。

  1. The remote branch gets pulled from remote repository branch like " stable " and then 远程分支从远程存储库分支(如“ stable ”)中拉出,然后
  2. do the git subtree pull to master ? git subtree pullmaster吗?

Sincerely, Wayne 真诚的韦恩

May be (not tested) the git subtree script tool may help here. 也许(未经测试) git子树脚本工具可以在这里提供帮助。
See its man page 参见手册页

It can merge/pull a subproject in your own repo, but it may concern all branches, so your two-step process could still be needed. 它可以合并/拉出您自己的存储库中的子项目,但它可能涉及所有分支,因此仍然需要两步过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM