恢复因强制推送而丢失的覆盖git commit [英] Recover overwritten git commit lost by force push
问题描述
我正在远程服务器上编写一个README.md文件,并完成了该操作,但是我不小心通过使用 git push origin master
和现在的 README强制将其推向了远程.md
不见了
I was writing a README.md file in the remote server and completed that one, but I accidentally did a force push to the remote by using git push origin master
and now the README.md
is gone
有没有一种方法可以检索该提交?我已经写了一个很长的README.md文件,真的想看看是否可以找回它:(
Is there a way I can retrieve that commit? I have written a very long README.md file and really want to see if I can get it back :(
我正在查看 git fsck
,却找不到我从github.com上的远程服务器提交的有关README.md的内容.
I was looking though the git fsck
and couldn't find the one about the README.md that I have commit from the remote server on github.com
推荐答案
在github的公共活动中,您可能会看到类似以下内容:
In Public Activity of github, you may see something like this:
XXX pushed to master at XX/XXX
d506bb1 Update README.md.
这里 d506bb1
是您丢失的提交.
这篇关于恢复因强制推送而丢失的覆盖git commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!