Undoing a git rebase

前端 未结 18 1425
孤城傲影
孤城傲影 2020-11-22 02:41

Does anybody know how to easily undo a git rebase?

The only way that comes to mind is to go at it manually:

  • git checkout the commit parent to both of t
18条回答
  •  忘了有多久
    2020-11-22 03:13

    Actually, rebase saves your starting point to ORIG_HEAD so this is usually as simple as:

    git reset --hard ORIG_HEAD
    

    However, the reset, rebase and merge all save your original HEAD pointer into ORIG_HEAD so, if you've done any of those commands since the rebase you're trying to undo then you'll have to use the reflog.

提交回复
热议问题