还原github存储库

时间:2017-04-06 08:48:07

标签: git github

我把文件夹放到错误的存储库中。在我git推送它之前,这个存储库中有几个文件。 在我将文件夹推送到此存储库后,我之前在此存储库中的文件已经消失。我已按git reset --hard HEADgit push --force还原了该文件夹,但未还原存储库。

有谁知道如何在此存储库中获取我以前的文件?

1 个答案:

答案 0 :(得分:0)

重置/撤消上次提交然后强制推送或者,将提交恢复为repo。

# undo the last commit
$ git reset --hard HEAD~1
$ git push -f

# revert the last commit (safe)
$ git revert HEAD~1..HEAD       # revert the last commit with new commit
$ git push
相关问题