How to combine two separate unrelated Git repositories into one with single history timeline

后端 未结 2 628
南方客
南方客 2020-12-09 11:24

I have two unrelated (not sharing any ancestor check in) Git repositories, one is a super repository which consists a number of smaller projects (Lets call it repository A).

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 11:56

    I think you do it like this:

    1. git remote add [repo b]
    2. git fetch//get the repo b into repo a
    3. due to you want to keep the history like this: A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (new repo A) you can first select the A0 as a start point, after that, use git cherry-pick one by one.

    Hope this is useful for you.

    Br, Tim

提交回复
热议问题