git-subtree is not retaining history so I cannot push subtree changes, how can I fix this/avoid this issue in the future?

前端 未结 2 1313
星月不相逢
星月不相逢 2020-12-29 07:11

I\'ve been using the git-subtree extension (https://github.com/apenwarr/git-subtree) to manage sub-projects within our main project. It\'s doing exactly what I want other t

2条回答
  •  清歌不尽
    2020-12-29 07:50

    @Chris Johnsen's answer is very right, it explains why spliting works in the clone not a pull situation.

    For the work around provided in the question and explained in footnote 2 of @Chris Johnsen's answer, I can confirm that git subtree split -P Some/Sub/Dir -b splitBranch --ignore-joins and git subtree split -P Some/Sub/Dir -b splitBranch 43b3eb7.. are acturally produced the same commit and same branch which can reflect the modifications done in the local repo, but can not be pushed to the original repoLib repo, because they don't have a common accesstor, even though git diff shows d76a03f0ec7e2 and 43b3eb7d69d are the same.

    So, in order to get subtree push working in a pull situation, the original repoLib remote repo must be added and fetched to get d76a03f0ec7e2 exsited to produce a branch that have a common accesstor with the original repoLib.

    The original reproduce script could not run smoothly under linux, here is a new one: http://pastebin.com/3NAQKEz9

提交回复
热议问题