Hacker News new | ask | show | jobs
by jedbrown 4814 days ago
This is backwards. Subtree import all the data from the sub-project. (There is no way to clone without getting the subtrees because they are a native part of the repository.) You interact with subtree as if you had one project, committing without needing to know that the subtree has its own upstream. You can split out the subtree history and send it upstream. Splitting it out changes the SHA1. You can merge from upstream back into the subtree. Subtree makes the most sense when you have a component that is completely dominated by its parent, but which you want to also release stand-alone.

Submodules provide weaker coupling and make the most sense when the submodule has its own healthy upstream and you want to track those versions. It's awkward if all submodule development is happening from within the parent.

1 comments

I think we agree about the functionality, but maybe not quite about when what is a appropriate. The subtree/submodule discussion is somewhat similar to merge vs rebase. There is a lot of personal/project-specific opinion in there.