扫码关注官方订阅号
远程仓库与本地仓库完全不一致,不小心强制提交了git push origin master -f,完全被覆盖了,现在还能回退吗?
git push origin master -f
执行 git reset 之后,在 .git/objects 文件夹里面的内容并没有相应的删除。
git reset
运行 git reflog 可以找到之前的提交 ID(commit_id)
git reflog
然后再 git reset --hard commit_id
git reset --hard commit_id
能啊,git reset --hard HEAD~1
git reset --hard HEAD~1
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
执行
git reset
之后,在 .git/objects 文件夹里面的内容并没有相应的删除。运行
git reflog
可以找到之前的提交 ID(commit_id)然后再
git reset --hard commit_id
能啊,
git reset --hard HEAD~1