Merge two Git repositories and keep the master history

前端 未结 1 1834
情话喂你
情话喂你 2020-12-18 03:04

I need to merge two Git repositories into a brand new, third repository. I followed the following instructions and they work, but the result is not what I

相关标签:
1条回答
  • 2020-12-18 03:46

    It's easy, instead of merging use rebase. Assuming you want to have repoA/master first just do (after fetching and adding remotes)

    # starting on master
    git rebase RepoB/master # place master on top of masterB
    git rebase RepoA/master # place master (with masterB) on top of masterA
    

    Note that rebases are potentially destructive and a bit unintuitive at first, so I strongly recommend reading about them first (SO documentation in the link above is a good place to start)

    0 讨论(0)
提交回复
热议问题