【问题处理】GIT删除主分支报错:[remote rejected] master (deletion of the current branch prohibited)

报错:


git -c diff.mnemonicprefix=false -c core.quotepath=false branch -d -r origin/new_master
Deleted remote branch origin/new_master (was 6625aae).


git -c diff.mnemonicprefix=false -c core.quotepath=false push origin :new_master
remote: error: refusing to delete the current branch: refs/heads/new_master
To https://Xiaodong_Gong@bitbucket.org/Xiaodong_Gong/my_bit.git
        ! [remote rejected] new_master (deletion of the current branch prohibited)
error: failed to push some refs to 'https://Xiaodong_Gong@bitbucket.org/Xiaodong_Gong/my_bit.git'
Completed with errors, see above


[remote rejected] master (deletion of the current branch prohibited)



原因:

这可是主分支,岂是你想删,想删就能删的?



解决:

通过更改主分支,都不是主分支了,就可以删掉了。


我用的是bitbucket。打开你的项目,看左侧有个Settings,点进去,把主分支改成别的分支就可以了。


至于别的代码托管网站,自己登上去找找就是了。



另:调整主分支/删除分支之类的动作,最好先搞个demo试试,练练手,以免造成难以恢复的损失。


  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值