We would like to enforce a new policy for our projects that the master branch now be called the release branch to ensure it is more clear as to how the branch should be used. Naturally, we will have develop and release candidate branches as well.
I understand I can rename the master branch locally by simply using the following:
git branch -m master release
However, that is only locally. Even if I push this up to the remote, the HEAD still points to the remote master branch. I want to get rid of the master branch completely and make the default local branch upon initial clone, be release.
How can I achieve this?
It seems that since the origin is on a Gitorious server, I get errors deleting the master branch. I'm trying to see now if it is possible to change this so that the default branch is 'release'.
git checkout -b release master # Create and switch to the release branch
git push -u origin release # Push the release branch to the remote and track it
git branch -d master # Delete local master
git push --delete origin master # Delete remote master
git remote prune origin # Delete the remote tracking branch
Please note, if you are using GitHub you will need to first change your "default" branch on GitHub after step 3:
In your repository on github.com go Settings → Branches → Default Branch. Change it to release and then do the rest of the steps.