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

2.76K 浏览服务器运维

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

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

线上服务器php版本是7.0。

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

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

解决方法

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

daaf7a1 <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{2}: pull origin master: Fast-forward 9c3f192 <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{3}: commit: git fix 68ae897 <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{4}: pull origin master: Merge made by the &#39;recursive&#39; strategy. 1c5d45d <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{5}: commit: fix a0138ff <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{6}: commit: live 99f747c <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{7}: pull origin master: Fast-forward 7c843f1 <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{8}: pull origin master: Fast-forward

2,然后用

git reset --hard <a href="/cdn-cgi/l/email-protection" class="__cf_email__">[email&#160;protected]</a>{n}

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

比如上图可运行 

git reset --hard 9c3f192

0