简体   繁体   English

在特定上下文中反转git子树拆分

[英]Reverse of git subtree split in certain context

Say, I have repo A which contains folder "foo". 说,我有一个包含文件夹“ foo”的仓库A。 There is also an already inited yet empty repo named B. 还有一个已经初始化但空的仓库,名为B。

Here's what I've done: 这是我所做的:

  1. git subtree split --prefix foo split-master
  2. cd B && git pull ../A split-master
  3. … a bunch of commits …
  4. git remote add bigA ../A
  5. git push bigA split-master

OK, so now I have a splitted branch split-master in A with all that commits from B. The question is - what is the reverse of split in this context? 好的,所以现在我在A中有一个拆分分支split-master,其中所有来自B的提交。问题是-在这种情况下,split的反向是什么? How can I reintegrate this split-master into a "big" repo? 如何将这个拆分主服务器重新集成到一个“大”仓库中?

Or is this something I actually shouldn't do? 还是我实际上不应该这样做? I mean, may I missing something? 我的意思是,我可能会错过什么吗? May be, I should pull everything from repo B? 可能是,我应该从回购B中提取所有内容吗?

Git subtree command also has a merge subcommand. Git subtree命令还具有merge子命令。 It follows the syntax: 它遵循以下语法:

> git subtree merge -P <prefix> <commit>

So in your case, running from within repo A you could do 因此,在您的情况下,您可以在仓库A中运行

> git subtree merge -P foo split-master

That would reintegrate the changes made in repo B into the subtree in repo A. 这会将仓库B中所做的更改重新集成到仓库A中的子树中。

There are some additional options, check the docs . 还有一些其他选项, 请检查docs

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

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