All good so far. We next want to delete the branch on github. However, if we do this the naive way:
git push origin :master
we just get an error like this:
remote: error: refusing to delete the current branch: refs/heads/master
To git@github.com:matthew-brett/datarray.git
! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to ‘git@github.com:matthew-brett/datarray.git‘
That is because github is looking at the master branch to provide the web content when you browse that repository. So we first have to make github look at our placeholder branch instead, then delete master.
First push up the placeholder branch:
git checkout placeholder # if not on placeholder already
git push origin placeholder
Then set placeholder to be the github default branch. Go to the main github page for your forked repository, and click on the “Admin” 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
and - no master branch...
delete master error(git push origin :master),布布扣,bubuko.com
delete master error(git push origin :master)
原文地址:http://www.cnblogs.com/qinyan20/p/3837431.html