恢复 git 重置即使它们不再显示在 repo 上

Restoring git reset even tho they dont show anymore on the repo

有人做了 git reset --hard f7fe845 并且他们将它推入了 repo 中的一个分支。

现在在该分支中我们看不到该提交之前完成的任何工作。有效地失去了该分支的所有工作。

我们需要还原 git 重置并将分支恢复到以前的版本,但至少在 git 网站或源代码树上其他提交不再存在.

有希望找回信息吗?怎么样?

我的分店是feature/UAL-117

[ec2-user@ame]$ git reflog
8c0136d HEAD@{0}: reset: moving to HEAD~1
f7fe845 HEAD@{1}: checkout: moving from develop to feature/UAL-117
f7fe845 HEAD@{2}: checkout: moving from feature/UAL-117 to develop
f7fe845 HEAD@{3}: checkout: moving from develop to feature/UAL-117
f7fe845 HEAD@{4}: checkout: moving from feature/UAL-117 to develop
f7fe845 HEAD@{5}: reset: moving to f7fe845df3efc0a6b79b4ccde50ab08fc542532f
6a03be3 HEAD@{6}: checkout: moving from develop to feature/UAL-117
f7fe845 HEAD@{7}: checkout: moving from f7fe845df3efc0a6b79b4ccde50ab08fc542532f to develop
f7fe845 HEAD@{8}: checkout: moving from feature/UAL-117 to f7fe845df3efc0a6b79b4ccde50ab08fc542532f
6a03be3 HEAD@{9}: pull: Fast-forward
24e9afe HEAD@{10}: pull: Fast-forward
d238450 HEAD@{11}: checkout: moving from develop to feature/UAL-117
f7fe845 HEAD@{12}: pull: Fast-forward
8c0136d HEAD@{13}: checkout: moving from feature/UAL-117 to develop
d238450 HEAD@{14}: checkout: moving from feature/UAL-117 to feature/UAL-117
d238450 HEAD@{15}: checkout: moving from develop to feature/UAL-117
8c0136d HEAD@{16}: checkout: moving from feature/UAL-117 to develop
d238450 HEAD@{17}: commit (merge): feature/UAL-117 update composer.lock
dd89670 HEAD@{18}: checkout: moving from develop to feature/UAL-117

如果问题是由于重置为 f7fe845,请尝试

git reset --hard 6a03be3

你可以运行:

git reflog

并希望看到类似“d238450 HEAD@{17}: commit ....”的内容 在输出中。

然后:

git reset --hard <commit>

其中 <commit> 指向您要恢复的快照(例如:d238450)。