git 版本回退 git reset --hard HEAD

一不小心用git pull拉取远程仓库代码 ,把本地开发的新代码直接覆盖掉,这时想恢复本地代码要如何操作

1.进入到项目git本地仓库文件夹下
2.打开cmd窗口,执行命令:git reflog
git 版本回退 git reset --hard HEAD
其中: [email protected]{0}表示当前版本,即你本地最新版本
3.找到需要回退的版本,执行命令:git reset --hard [email protected]{n}
例如:最新版本:git reset --hard 506a62f

文章参考:https://www.cnblogs.com/zuiyue_jing/p/11123654.html

相关文章:

  • 2021-08-16
  • 2021-12-06
  • 2021-04-20
猜你喜欢
  • 2021-08-29
  • 2021-08-29
  • 2018-07-08
  • 2021-05-18
  • 2021-08-29
  • 2019-11-18
  • 2021-08-29
  • 2021-10-28
相关资源
相似解决方案