NguyenTrungTin
11/1/2018 - 10:36 AM

Undo after git rebase/git merge

Undo after git rebase


git reset --hard ORIG_HEAD

Undo after git merge


git reset --merge ORIG_HEAD

Note: You can use git reflog and @ syntax also (google for more detail)

E.g. Reset to the 2 HEAD moves ago


git reflog

# The reflog will show here

Then you can use:


git reset --hard HEAD@{2}