【Git】マージやコミットを戻す

git の log に残さず、マージやコミットなどの操作を戻す方法です。
git reflog で履歴を確認し、git reset で戻したい HEAD を指定します。

$ git reflog

4a8b905 (HEAD -> feature/test) HEAD@{0}: checkout: moving from feature/temp to feature/test
f085ef0 (origin/feature/temp, feature/temp) HEAD@{1}: reset: moving to HEAD@{1}
b30cc9b (origin/feature/aaa, origin/develop, develop) HEAD@{2}: merge develop: Fast-forward
f085ef0 (origin/feature/temp, feature/temp) HEAD@{3}: checkout: moving from feature/test to feature/temp

$ git reset --hard HEAD@{1}