Gitlab回滚到上次提交
1、查看所有commits記錄
 $?git log
2、 gitlab回退到某次commit
 $ git reset --hard 3018a546427e1f865524b82b488d6a2721d00759
 $ git reset 3018a546427e1f865524b82b488d6a2721d00759
 注意:3018a546427e1f865524b82b488d6a2721d00759為commit id
3、強制重新提交到遠程
 $ git push -f
git報錯You are not allowed to force push code to a protected branch on this project解決方案
當我們有時候回滾了代碼,想強制push到遠程倉庫的時候,
 $ git push origin --force
會報如下錯誤:
 You are not allowed to force push code to a protected branch on this project
如果用的是gitlab版本庫,這說明gitlab對倉庫啟用了保護,需要在倉庫中設置一下:
 "Settings" -> "Repository" -> scroll down to "Protected branches". -> 找到項目,點擊"Unprotect"按鈕,使項目不受保護。
重新執行如下命令即可:
 $ git push origin --force
總結
以上是生活随笔為你收集整理的Gitlab回滚到上次提交的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Voronoi Noise
- 下一篇: WRF运行问题
