重置后还原git commit

时间:2019-02-19 04:25:45

标签: linux github

在执行git reset之后,我失去了所有工作,我想撤消我重置HEAD的事情。

这是我的日志:

c2415f9 (HEAD -> master) HEAD@{0}: reset: moving to HEAD@{4}

c2415f9 (HEAD -> master) HEAD@{1}: reset: moving to HEAD@{1}

efc857e HEAD@{2}: reset: moving to HEAD~9

c2415f9 (HEAD -> master) HEAD@{3}: reset: moving to HEAD~1

ee49352 HEAD@{4}: commit: update design

c2415f9 (HEAD -> master) HEAD@{5}: commit (merge): design update

bd7b690 HEAD@{6}: commit: design update2

dbcdb7c HEAD@{7}: commit: design update

c376c79 HEAD@{8}: reset: moving to HEAD^

1f0e877 HEAD@{9}: reset: moving to HEAD^

a801027 HEAD@{10}: commit: design update

1f0e877 HEAD@{11}: reset: moving to HEAD~1

7b298f1 HEAD@{12}: commit (amend): design update

f25ac06 HEAD@{13}: commit: design update

1f0e877 HEAD@{14}: commit (merge): temp4

c376c79 HEAD@{15}: commit: UI and icon updated

5116b62 HEAD@{16}: commit: error changes

d642af7 HEAD@{17}: commit (merge): menifast

b4785c0 HEAD@{18}: commit: xml

6fb07e9 HEAD@{19}: reset: moving to HEAD

6fb07e9 HEAD@{20}: checkout: moving from temp to master

a5649d7 (origin/temp, temp) HEAD@{21}: reset: moving to HEAD

我想回到Head {5},我只想撤消所有重置的东西!帮帮我!

1 个答案:

答案 0 :(得分:0)

获取提交的标识符。然后使用:

git reset <commit-retrieved-using-reflog>

所以,对您来说是

git reset HEAD@{5}