Git: How to rebase to a specific commit?

后端 未结 9 616

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:40

    There is another way of doing it or if you wish to move back to more than just one commit.

    Here is a an example to move back to n number of commits:

    git branch topic master~n
    

    For the sake of this question, this can also be done:

    git branch topic master~1
    

    The command works perfectly on git version 2.7.4. Haven't tested it on any other version.

提交回复
热议问题