我想恢復到我以前的承諾(承諾4d462937b006da1fbc710bc33bf3bab76de1ede2)與我的所有文件(其中一些已被刪除)恢復刪除的文件
(venv) [[email protected]_arch project]$ git log
commit d0b07921e818c5c5abdb92f0e563f4d186370b6f
Author: Nikos Dalezios <[email protected]>
Date: Tue Mar 1 21:03:11 2016 +0200
test
commit 4d462937b006da1fbc710bc33bf3bab76de1ede2
Author: Nikos Dalezios <[email protected]>
Date: Sun Feb 28 20:07:01 2016 +0200
ok
(venv) [[email protected]_arch project]$ git reflog
d0b0792 [email protected]{0}: pull origin master: Fast-forward
4d46293 [email protected]{1}: reset: moving to 4d46293
e0e0368 [email protected]{2}: reset: moving to HEAD^
4d46293 [email protected]{3}: reset: moving to 4d46293
d0b0792 [email protected]{4}: checkout: moving from 4d462937b006da1fbc710bc33bf3bab76de1ede2 to d0b0792
4d46293 [email protected]{5}: checkout: moving from master to 4d46293
4d46293 [email protected]{6}: reset: moving to HEAD^
d0b0792 [email protected]{7}: commit: test
4d46293 [email protected]{8}: commit: ok
我真的把事情搞亂了,我失去了一些文件的Python代碼(幾百行)。 HEAD @ {8}是我需要回去點.....
感謝
我不知道這是否可以幫助,但我的命令歷史是這樣的
git rm -r *
git reset --hard HEAD
git reset HEAD
git commit -a
git reset --hard HEAD^
git checkout 4d46293
git checkout d0b0792
git reset --hard 4d46293
git reset --hard HEAD^ #4d46293
Duplicated http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit –