How do I rename my Git ‘master’ branch to ‘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 SettingsBranchesDefault Branch. Change it to release and then do the rest of the steps.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)