Git回滚代码到某个commit

匿名 (未验证) 提交于 2019-12-02 23:34:01
 #回退命令:   $ git reset --hard HEAD^         #回退到上个版本 $ git reset --hard HEAD~3        #回退到前3次提交之前,以此类推,回退到n次提交之前 $ git reset --hard commit_id     #退到/进到 指定commit的sha码   #强推到远程:  
 $ git push origin HEAD --force

 #先显示提交的log  $ git log -3 commit 4dc08bb8996a6ee02f Author: Mark <xxx@xx.com> Date:   Wed Sep 7 08:08:53 2016 +0800      xxxxx  commit 9cac9ba76574da2167 Author: xxx<xx@qq.com> Date:   Tue Sep 6 22:18:59 2016 +0800      improved the requst  commit e377f60e28c8b84158 Author: xxx<xxx@qq.com> Date:   Tue Sep 6 14:42:44 2016 +0800      changed the password from empty to max123 #回滚到指定的版本  git reset --hard e377f60e28c8b84158 #强制提交  git push -f origin master

文章来源: https://blog.csdn.net/BlueBirdssh/article/details/90521080
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!