Git/hub submodule: track upstream & modify without missing commits

时间:2016-04-21 22:33:32

标签: git github git-submodules

So there are two specific setups. First:

repoA
    submoduleB  <-- repoB-upstream

With this setup, submodule update --remote tracks the latest changes from repoB-upstream. From submoduleB I can commit local changes, and from repoA I can commit changes to submoduleB. Unfortunately, commits in repoA will only store hashes of the changes to submoduleB. Since I don't have commit rights to repoB-upstream, on cloning repoA others will receive:

fatal: reference is not a tree: <hash>
Unable to checkout '<hash>' in submodule path '<submoduleB>'

It would be nice if local commits from submoduleB where stored in repoA...

Second:

repoA
    submoduleB  <-- repoB-fork  <-- repoB-upstream

In this setup, I have commit rights to repoB-fork and can push changes from submoduleB. Therefore submodule update --remote won't throw "unable to checkout" errors. Unfortunately, I now have to manually merge changes from repoB-upstream into repoB-fork.

So,

Is there some way to get the best of both worlds?

0 个答案:

没有答案