How to revert multiple git commits?

后端 未结 13 2374
被撕碎了的回忆
被撕碎了的回忆 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 07:47

    First be sure that your working copy is not modified. Then:

    git diff --binary HEAD commit_sha_you_want_to_revert_to | git apply
    

    and then just commit. Don't forget to document what's the reason for revert.

提交回复
热议问题