How to undo a successful “git cherry-pick”?

后端 未结 6 1880
无人及你
无人及你 2021-01-30 02:12

On a local repo, I\'ve just executed git cherry-pick SHA without any conflicts or problems. I then realized I didn\'t want to do what I just did. I have not pushed

6条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 02:43

    One command and does not use the destructive git reset command:

    GIT_SEQUENCE_EDITOR="sed -i 's/pick/d/'" git rebase -i HEAD~ --autostash

    It simply drops the commit, putting you back exactly in the state before the cherry-pick even if you had local changes.

提交回复
热议问题