美文网首页iOS点点滴滴
git 回退代码到指定提交

git 回退代码到指定提交

作者: pengxiaochao | 来源:发表于2017-11-16 14:02 被阅读49次

    回退代码,分两种情况,

    • 1.多次提交已经,提交到服务器;
    • 2.本地多次提交,没有推送到远程服务器;

    1.第一种情况, commit 还没有推送到服务器

    这里我利用soucreTree 作会退代码

    image
    image image
    image

    2.第二种情情况

    本地提交已经推送到git服务器,需要回滚服务器的代码

    这里展示命令

    git reflog
    
    git reset --hard 「需要回滚的代码版本号」
    
    

    紧接着强制推送到远程分支

    git push -f
    
    

    回滚成功
    截图


    image

    相关文章

      网友评论

        本文标题:git 回退代码到指定提交

        本文链接:https://www.haomeiwen.com/subject/enemmxtx.html