How to merge nested git repo into parent repo, retaining history?

前端 未结 4 1528
天命终不由人
天命终不由人 2020-12-31 18:42

Now I know most git experts will immediately think of git rebase, but I am using the word \"rebase\" in the more general sense: I have the following structure o

4条回答
  •  温柔的废话
    2020-12-31 19:22

    I needed to do the same thing and this worked for me:

    From the parent repo,

    git remote add -f subrepo git@github.com:sub/repo.git
    git merge -s ours --no-commit subrepo/master
    git read-tree --prefix=subrepo/ -u subrepo/master
    git commit -m "Subtree merged"
    

    This is from a GitHub post that also has more detail: https://help.github.com/articles/about-git-subtree-merges/

提交回复
热议问题