Wednesday, April 1, 2015

Git: undo the last rebase

$ git reflog

f0d821f HEAD@{0}: commit_a
2ea24f8 HEAD@{1}: commit_b
0c3cd49 HEAD@{2}: commit_c
de5b02a HEAD@{3}: commit_d

Suppose that "commit_c" was the head commit of the branch just before the rebase. Let's reset the current branch to this commit:

$ git reset --hard HEAD@{2}

No comments:

Post a Comment