获取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命令即可回退回上次提交之前的状态

 

相关文章:

  • 2021-07-16
  • 2021-04-05
  • 2021-04-20
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2021-08-20
  • 2021-10-04
  • 2021-11-02
  • 2021-07-08
  • 2022-12-23
相关资源
相似解决方案