場(chǎng)景:項(xiàng)目部署發(fā)布后發(fā)現(xiàn)有問(wèn)題,需要回滾到某一個(gè)commit,再重新發(fā)布
關(guān)鍵點(diǎn):先將本地分支退回到某個(gè)commit,刪除遠(yuǎn)程分支,再重新推送本地分支
操作步驟:
1、git checkout the_branch // 切換到某個(gè)分支
2、git pull // 獲取最新代碼
3、git branch the_branch_backup // 備份這個(gè)分支
4、git push origin the_branch_backup // 將備份分支推送到遠(yuǎn)程倉(cāng)庫(kù)
5、git reset --hard the_commit_id // 把the_branch本地回滾到某個(gè)提交
6、git push origin :the_branch // 刪除遠(yuǎn)程 the_branch,注意有【:】
7、git push origin the_branch // 將回滾后的本地分支重新推送到遠(yuǎn)程倉(cāng)庫(kù)文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-627388.html
8、git push origin :the_branch_backup // 刪除遠(yuǎn)程備份分支文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-627388.html
到了這里,關(guān)于git 回滾遠(yuǎn)程分支的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!