Git how to rollback a rebase

后端 未结 2 1174
误落风尘
误落风尘 2020-12-22 16:49

In Git, how do you rollback a rebase if you\'re not happy with it?

Git doesn\'t have dry-run for rebase. If I did a rebase and have not pushed it yet, how do I rollb

2条回答
  •  囚心锁ツ
    2020-12-22 17:14

    Rebase keeps a backup of the old state as ORIG_HEAD.
    So you can revert the last rebase by running:

    git reset --hard ORIG_HEAD
    

提交回复
热议问题