1、版本回退
git reset --hard f7f4ecb2b2 ----- f7f4ecb2b2 为需要回退的版本号
再强制回滚远程的正式分支:
git push origin master --force
本地已经回滚到这个提交id的当前状态。如果要远程分支也变成这次的状态,需要继续回滚,输入一下的命令
git push -f origin dev(master)
如果需要分支被保护无法回退:
You are not allowed to force push code to a protected branch on this project
如果用的是gitlab版本库,这说明gitlab对仓库启用了保护,需要在仓库中设置一下:
"Settings" -> "Repository" -> "Protected branches"