2020年9月28日 星期一

Git how to rollback a rebase

 You can use the reflog to find the first action before the rebase started and then reset --hard back to it. e.g.

$ git reflog

b710729 HEAD@{0}: rebase: some commit
5ad7c1c HEAD@{1}: rebase: another commit
deafcbf HEAD@{2}: checkout: moving from master to my-branch
...

$ git reset HEAD@{2} --hard


from : https://stackoverflow.com/questions/41049711/git-how-to-rollback-a-rebase/41049867