m2线上服务器git pull 撤销误操作的解决办法

3.53K 浏览服务器运维

m2线上服务器git pull 撤销误操作的解决办法

本地m2升级到2.3.0了,php版本是7.2。

线上服务器php版本是7.0。

今天不小心直接在线上服务器pull了,导致一大堆报错,php版本兼容性的问题。

没办法,只能撤销pull操作,回到pull之前的状态。

解决方法

1、运行git reflog命令查看你的历史变更记录,如下:

daaf7a1 [email protected]{2}: pull origin master: Fast-forward 9c3f192 [email protected]{3}: commit: git fix 68ae897 [email protected]{4}: pull origin master: Merge made by the 'recursive' strategy. 1c5d45d [email protected]{5}: commit: fix a0138ff [email protected]{6}: commit: live 99f747c [email protected]{7}: pull origin master: Fast-forward 7c843f1 [email protected]{8}: pull origin master: Fast-forward

2,然后用

git reset --hard [email protected]{n}

,(n是你要回退到的引用位置)回退。

比如上图可运行 

git reset --hard 9c3f192

0