About Renaming Master Branch to Primary

A) Rename the git master branch to primary:

1
2
3
$ git branch --move master primary
$ git push --set-upstream origin primary
$ git remote set-head origin primary

B) Change the main branch to primary at GitHub or Bitbucket settings.

C) Delete the remotely used master:

1
$ git push origin --delete master

D) Change your deployment scripts to use primary as the main branch.

E) On other machines that are using this repo, update branch list:

1
2
3
4
5
$ git fetch
$ git remote set-head origin primary
$ git remote update origin --prune
$ git checkout primary
$ git branch --delete master

Tips and Tricks Dev Ops Bash Git