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

226 阅读1分钟

本地拉远端分支时,不小心拉错了代码。怎么办?

参考:blog.csdn.net/code_segmen…

第一步:git reflog

image.png

第二步: git reset --hard ae5244a8 // 这里写自己要回退到的 commit id

通过以上两步,拉错了的代码就回到了之前的状态。