我无法删除git上的远程主分支 [英] I can't delete a remote master branch on git

查看:723
本文介绍了我无法删除git上的远程主分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除一个主分支,但事实证明这很难。我只是想清理那个分支并开始新的。我正在从开发分支中删除。我希望GitHub上的主人干净。

 #git push origin --delete master 

> ;到https://github.com/mymasterb.git! [远程拒绝] master
> (禁止删除当前分支)错误:无法推送一些
>参考'https://github.com/mymaster.git'

我该如何简单地开始我的主人有一块新鲜的石板?

解决方案

正如删除master分支by Matthew Brett,您需要更改您的GitHub repo默认分支


您需要转到您的分支存储库的主github页面,然后单击设置按钮。



屏幕顶部附近有一个Default branch下拉列表。

从那里选择占位符。

在界面上,我正在寻找在下拉列表上方出现一个绿色标记

现在您可以执行(从命令行):



  git push origin:master 

注:不再有绿色的勾号:只要您在下拉列表中选择另一个分支,修改就会生效。


I need to delete a master branch, but it's proving to be hard. I just want to clean that branch out and start new. I am deleting from the dev branch. I want master on GitHub to be clean.

 # git push origin --delete master

> To https://github.com/mymasterb.git  ! [remote rejected] master
> (deletion of the current branch prohibited) error: failed to push some
> refs to 'https://github.com/mymaster.git'

How do I quite simply start my master with a fresh slate?

解决方案

As explained in "Deleting your master branch" by Matthew Brett, you need to change your GitHub repo default branch.

You need to go to the main github page for your forked repository, and click on the "Settings" button.

There’s a "Default branch" dropdown list near the top of the screen.
From there, select placeholder.
On the interface I’m looking at, a green tick appears above the dropdown list.
Now you can do (from the command line):

git push origin :master

Note: there is no longer a green tick: the modification is valid as soon as you select another branch in the dropdown list.

这篇关于我无法删除git上的远程主分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆