zoukankan      html  css  js  c++  java
  • git--不小心推代码到master之后,怎么办?

    获取commit id

    git log

    确定你要回滚到哪个版本

    git reset --hard commit_id
    git push origin master --force

    成功!

    报错:remote: GitLab: You are not allowed to force push code to a protected branch

    如果用的是gitlab版本库,这说明gitlab对仓库启用了保护,需要在仓库中设置一下:

    "Settings" -> "Repository" -> scroll down to "Protected branches".

    在gitlab重新设置之后,重新执行push命令即可回退回上次提交之前的状态

  • 相关阅读:
    今日总结
    今日总结
    今日总结
    今日总结
    今日总结
    java自学
    java自学
    Java自学
    Java自学
    java自学
  • 原文地址:https://www.cnblogs.com/lutt/p/13579726.html
Copyright © 2011-2022 走看看