Question

Say, I have repo A which contains folder "foo". There is also an already inited yet empty repo named 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? 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?

Was it helpful?

Solution

Git subtree command also has a merge subcommand. It follows the syntax:

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

So in your case, running from within repo A you could do

> git subtree merge -P foo split-master

That would reintegrate the changes made in repo B into the subtree in repo A.

There are some additional options, check the docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top