I can't delete a remote master branch on git

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.

链接地址: http://www.djcxy.com/p/16012.html

上一篇: 无法在git中删除远程分支

下一篇: 我无法删除git上的远程主分支