1、項目右鍵后,點擊“Git - Show History”

2這里會顯示有歷史提交的版本記錄(這里我們假設要回滾到 “提交” 版本中)

2、選中 “提交” ,右鍵Copy Revision Number

3、回到項目,右鍵-Git-Repository-Reset HEAD

4、Reset Type選擇Hard,To Commit處黏貼剛剛復制的版本號;然后點擊Reset按鈕

以上操作就能夠使得項目回滾到“提交”版本
(注:操作之后提交版本會進行報錯)
(1)、點擊IDEA右下角,輸入“ git push -u origin master -f “這個代碼是表示沖突的時候強制提交,一般不建議

如果出現以下代碼,說明在代碼平台上這個分支是受保護的,不允許提交,可以在代碼平台上把分支先設置成不保護狀態
|
1
|
remote: GitLab: You are not allowed to force push code to a
protected
branch on
this
project.
|
出現以下內容表示提交成功
|
1
2
3
4
5
6
7
8
9
|
Enumerating objects:
49
, done.
Counting objects:
100
% (
49
/
49
), done.
Delta compression using up to
8
threads
Compressing objects:
100
% (
26
/
26
), done.
Writing objects:
100
% (
32
/
32
),
139.99
KiB |
46.66
MiB/s, done.
Total
32
(delta
7
), reused
18
(delta
2
)
To 提交地址
+
0304112
...e40991a master -> master (forced update)
Branch
'master'
set up to track remote branch
'master'
from
'origin'
.
|
