1. 程式人生 > >【Gitlab】GIT回滾master分支到指定tag版本 並提交遠程倉庫

【Gitlab】GIT回滾master分支到指定tag版本 並提交遠程倉庫

git master 回滾

【Gitlab】GIT回滾master分支到指定tag版本 並提交遠程倉庫
1 查看分支
git branch

2 切換到master分支
git checkout master

3 查看標簽
git tag
v1.3.3
v1.3.4
v1.3.5

4 查看某個標簽的詳情
git show v1.3.5
commit fb479960c0cec5549463ae123d70bdd72ccf6be7

5 通過commit id回退
git reset --hard fb479960c0cec5549463ae123d70bdd72ccf6be7

6 顯示所有提交過的版本信息
git log

7 查看所有分支的所有操作記錄
git reflog

8 顯示工作目錄和暫存區的狀態
git status

9 提交遠程倉庫
git push origin master

10 git報錯,需要進入gitlab項目設置,protected branches裏取消master的protected,設置

技術分享圖片
技術分享圖片

11 再次push本地master分支
git push origin master

12 加入-f參數,強制提交,遠程端將強制跟新到reset版本
git push -f origin master

13 版本回退完畢後,在gitlab項目設置,protected branches裏設置回master的protected。

【Gitlab】GIT回滾master分支到指定tag版本 並提交遠程倉庫