[Git] git rebase を undo したい

一度実行した git rebase を取り消す方法。

git rebase -i を実行

% git rebase -i HEAD~3
[detached HEAD 1767045] added hide checkout & cart empty button, and pay_type table.
 27 files changed, 279 insertions(+), 15 deletions(-)
# 省略
Successfully rebased and updated refs/heads/master.

git rebase 後の状況。

% git log --pretty=oneline
1767045c940a52e220c22dd81bdf05a9db72d6cf added hide checkout & cart empty button
1d90eb6bd42e5cc4f2d56f689161da3bccfc71fc depot_g Check out
6be308fafbcfbaf31768ce5512e9919cd4524d11 jQuery UI blind in cart empty action
b35631c507b1ed4e3e06fabb932cb83180eef11e depot_f Add a dash of Ajax

git reflog, reset で取り消します。

% git reflog
1767045 HEAD@{0}: rebase -i (finish): returning to refs/heads/master
1767045 HEAD@{1}: rebase -i (fixup): added hide checkout & cart empty button, an
f9234b6 HEAD@{2}: rebase -i (start): checkout HEAD~3
b2ad40d HEAD@{3}: commit: bug_fix pay_type name in view show.html.erb
f9234b6 HEAD@{4}: checkout: moving from depot_g_RPT to master
6264cec HEAD@{5}: commit: added who_bought req(HTML, XML, JSON)
#省略
% git reset --hard HEAD@{3}
HEAD is now at b2ad40d bug_fix pay_type name in view show.html.erb

戻りました。

% git log --pretty=oneline
b2ad40d74c0d4ad3384b414cc66d389ab98a10bf bug_fix pay_type name in view show.html
f9234b6eb48b69eaa83ac336a1b919c4a00b9b0c added hide checkout & cart empty button
1d90eb6bd42e5cc4f2d56f689161da3bccfc71fc depot_g Check out
6be308fafbcfbaf31768ce5512e9919cd4524d11 jQuery UI blind in cart empty action
b35631c507b1ed4e3e06fabb932cb83180eef11e depot_f Add a dash of Ajax