Git: How to rebase to a specific commit?

后端 未结 9 567

I\'d like to rebase to a specific commit, not to a HEAD of the other branch:

A --- B --- C          master
 \\
  \\-- D                topic
<
9条回答
  •  囚心锁ツ
    2020-12-07 08:26

    You can avoid using the --onto parameter by making a temp branch on the commit you like and then use rebase in its simple form:

    git branch temp master^
    git checkout topic
    git rebase temp
    git branch -d temp
    

提交回复
热议问题