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