1.備份原master代碼
git checkout master
git pull
git checkout -b master-copy
2.切換到要更換為主分支的分支上
git checkout xx
?3.刪除本地主分支
git branch -D master
4.刪除遠程主分支
git push origin -d master
?報錯原因:這可是主分支,豈是你想刪,想刪就能刪???
解決:
git找到這個項目,管理-修改默認分支
重新提交ok??git push origin -d master
5.新建master主分支?,并將其推送至遠端
git checkout -b master
git push -u origin master
?
?6.回到步驟4,修改默認分支為主分支
?文章來源地址http://www.zghlxwxcb.cn/news/detail-608677.html文章來源:http://www.zghlxwxcb.cn/news/detail-608677.html
?
到了這里,關(guān)于git切換主分支為其他分支的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!