How to rebase one repo to another

后端 未结 4 1411
眼角桃花
眼角桃花 2021-02-05 20:58

Let\'s say I have two different repositories like so:

Project 1:
Init---A---B---C---HEAD1

Project 2:
Init---D---E---F---G---HEAD2

Is there a w

4条回答
  •  忘掉有多难
    2021-02-05 21:31

    The solution I used was as follows:

    • In Project 2:

      git format-patch  --stdout > /path/to/patch.diff
      

      Where refers to the first commit in the "from" repository you wish to merge to the "target".

    • In Project 1:

      git am /path/to/patch.diff
      

    This replays every commit from to HEAD in Project 2 onto Project 1.

    This completely avoids the need for a common ancestor between the projects, as most git-specific tools require.

提交回复
热议问题