Search code examples
gitgit-submodulesgit-subtreegit-subrepo

Tracking a child-repository in the parent, preserving pull-ability


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.


Solution

  • Subtree merging was the answer.