问题描述:
提交代码时,因为文件太大,多次push失败,然后打算回退,rebase了两次,本地代码丢失了,吓得我差点跳起来。
lcc@lcc MyDoc$ git reset --hard 9c15d6f85a9bcb68899278dbaab5ac3a449390ea
lcc@lcc MyDoc$ git push origin HEAD --force
解决方法如下:
1、执行命令:
lcc@lcc MyDoc$ git reflog
9c15d6f (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: reset: moving to 9c15d6f85a9bcb68899278dbaab5ac3a449390ea
0bd8c12 HEAD@{1}: reset: moving to 0bd8c12c3b44c5d16ff6e9ce84d00230561b7f12
fcae336 HEAD@{2}: commit: drui io
0bd8c12 HEAD@{3}: reset: moving to 0bd8c12c3b44c5d16ff6e9ce84d00230561b7f12
0a69e82 HEAD@{4}: commit: 第二次提交,大文件失败
de978a9 HEAD@{5}: reset: moving to HEAD
de978a9 HEAD@{6}: reset: moving to de978a99704e1bec6d2e81fcfd24900e6be43d8e
f96a7d2 HEAD@{7}: reset: moving to f96a7d270c8d6a253530309a9f485a8d2a84befe
f96a7d2 HEAD@{8}: commit: 第一次提交
de978a9 HEAD@{9}: reset: moving to de978a99704e1bec6d2e81fcfd24900e6be43d8e
de978a9 HEAD@{10}: reset: moving to de978a99704e1bec6d2e81fcfd24900e6be43d8e
2、用reset (Suppose the old commit was HEAD@{5} in the ref log)
git reset --hard HEAD@{8}
亲测有效!解决了~解决了~
猜你喜欢:暂无回复。