操作
- 切到本地master上,然后選擇某一次提交記錄,例如回退到
731ecae
這次的提交,終端git reset --soft 731ecae
。 - 回退完畢push到origin/master,
git push -f origin master
,必須有-f,表示強制的意思。
error狀況
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://xxx.xxx.com/root/ios.git' ,需要git上關閉項目protected選項。
該項目 --> settings --> repository --> Protected Branches --> 點擊unprotect。
此時再次執行上面的push命令, 完畢;