Apr 28

回滚代码 不指定

bkkkd , 13:54 , 开发应用 , 评论(0) , 引用(0) , 阅读(1127) , Via 本站原创 | |
更新一个版本到更新后,发现有bug.需要进行回滚代码(只限代码出现bug,未出现数据结构或数据更新)

1.在本地的开发副本中,查看需要回溯的分支

git log

commit dc2f72f51522665980e474013dfc577a7a6fb054 (HEAD -> 6.0, origin/HEAD, origin/6.0)
Merge: f96be7b dcd39c8
Author: thinkphp <thinkphp@qq.com>
Date:   Tue May 31 12:54:26 2022 +0800

    Merge branch '6.0' of github.com:top-think/think into 6.0

commit f96be7b7ede70f5c52aa32d5616eb08a0b252b95
Author: thinkphp <thinkphp@qq.com>
Date:   Tue May 31 12:53:51 2022 +0800

    去除腾讯统计




2. 复制提交码(commit后的代码),并强制切换到该 版本

git reset --hard f96be7b7ede70f5c52aa32d5616eb08a0b252b95

3. 强制更新到远程的分支

git push -f -u origin master

4. 然后到服务端的的副本,新代码切换回到最新

git pull
git reset origin/master
git checkout -- .
git clean -fd

服务端的副本即可还原到原来的版本.后面需要再合并到代码到master也不会受到影响
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]