2026-05

git reset 后还能找回丢失的代码吗?

适用场景:使用远程仓库覆盖了本地仓库的提交

  1. git reflog #查看 reflog 发现丢弃的提交
  2. git reset –hard 1c67128c #恢复到最近一次丢弃的提交