重新引导已合并的分支

时间:2013-06-06 22:23:28

标签: git

我有一个功能分支已经合并(在M中),但之后又恢复了(在R中):

S---o-o-----M-o-R-o
 \         /
  A-----B-C       ^ master

          ^ feature

我想将feature分支重新定位到当前的master,所以我得到了:

S---o-o-----M-o-R-o-A'-B'-C'
 \         /
  A-----B-C               ^ new master or new branch
                  ^ old master
          ^ feature

这类似于revert-a-faulty-merge.txt附录中描述的过程,但不是基于S的新分支,而是基于当前{{1} }}

根据this question,此解决方案应该有效:

  

master
  这仍然有点冒险,因为你需要使用D的SHA(例如,不是X)。

所以我尝试了git rebase --onto stable D fix/123,但它只是将git rebase --no-ff --onto master S feature标签提升为feature标签并说“快速转发功能”,而不会生成任何新提交。

那么我怎样才能基本上将整个master分支复制到master之上?

1 个答案:

答案 0 :(得分:4)

git cherry-pick现在支持一系列提交,如下所示:

git cherry-pick S..C

这将在 S到C之后提交。您也可以指定从A的开始,如下所示:

git cherry-pick A^..C