pull错代码,恢复到pull之前 ---本地代码回退

本地拉远端分支时,不小心拉错了代码。网上查找了一下,按照此篇文章进行操作。

https://blog.csdn.net/code_segment/article/details/78597441?locationNum=4&fps=1

(1)git reflog

(2) git reset --hard ae5244a8     填写自己想要回退的版本

通过以上两部,拉错了的代码就回到了之前的状态。把commit message写的清楚有意义,方便代码出错,回退。

总结

git reflog 先看到提交的代码的id,

git reset --hard [id]      id是你要回退的代码的id

猜你喜欢

转载自blog.csdn.net/mia1106/article/details/84634832