How to revert multiple git commits?

后端 未结 13 2399
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 07:36

I have a git repository that looks like this:

A <- B <- C <- D <- HEAD

I want the head of the branch to point to A, i.e. I want B

13条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 08:04

    In my opinion a very easy and clean way could be:

    go back to A

    git checkout -f A
    

    point master's head to the current state

    git symbolic-ref HEAD refs/heads/master
    

    save

    git commit
    

提交回复
热议问题