# work on local master
git checkout master
# reset to the previous state of origin/master, as recorded by reflog
git reset --hard origin/master@{1}
# at this point verify that this is indeed the desired commit.
# (if necessary, use git reflog to find the right one, and
# git reset --hard to that one)
# finally, push the master branch (and only the master branch) to the server
git push -f origin master
修剪超过指定时间的项。如果此选项不是
specified, the expiration time is taken from the configuration setting
ReflogExire,它的默认值为90天
删除条目,不管它们的年龄大小; ——過期 = 永不关闭
删除可到达的条目(但请参见——过期-不可到达)。
所以你可以这样做:
1-git reflog
2-你选择 Head _ Number 你想用 git reset –hard HEAD@{HEAD-NUMBER}恢复吗