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.
Or, since 2012, you can delete that same branch directly on GitHub:
That was announced in Sept. 2013, a year after I initially wrote that answer.
Note: for BitBucket, Tum reports in the comments: