1

I can't figure out if subtrees, or otherwise are the answer here; I really only know that submodules (probably) are not.

  • I have a repository at ./parent (with it's remote on GitHub)
  • I want to clone a remote repository into ./parent/child
  • I want to track the changes I make in the child repository as the parent's history
  • I want to be able to pull changes from the child repository's remote (and probably squash them)
  • I do not need to push changes to the child's remote; it will be pull-only.

What strategy should I use to manage this?

In plainer English: I want to include one project as a child in another, and I want to modify the source of the child as needed, track the changes in the parent (as though it were just another subdirectory) but still be able to pull remote changes into the child (as updates are made)

Perhaps yet another way of describing the problem; it would be a repository with two remotes, one is push/pull, the other is pull only with its local copy in a subdirectory.

Dan Lugg
  • 20,192
  • 19
  • 110
  • 174
  • 1
    Looks like a good case for [subtree merge](https://stackoverflow.com/a/1426163/2303202) – max630 Jun 14 '17 at 09:42
  • I think the problem is I may not sufficiently understand subtree. I will re-read the docs; offhand, are there any special considerations I will have to make? – Dan Lugg Jun 14 '17 at 13:09
  • It's hard to say because I don't know what you don't know. Basically there is no magic there, it's just as if source repository was moved to subdirectory and then merged. It is very old trick, it is even used for the git itself: https://github.com/git/git/tree/master/gitk-git – max630 Jun 14 '17 at 19:32

1 Answers1

0

Subtree merging was the answer.

Dan Lugg
  • 20,192
  • 19
  • 110
  • 174