How to revert multiple git commits?

后端 未结 13 2586
被撕碎了的回忆
被撕碎了的回忆 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:07

    None of those worked for me, so I had three commits to revert (the last three commits), so I did:

    git revert HEAD
    git revert HEAD~2
    git revert HEAD~4
    git rebase -i HEAD~3 # pick, squash, squash
    

    Worked like a charm :)

提交回复
热议问题