Renaming the main branch in MOM6 - adcroft/MOM6 GitHub Wiki

Synopsis

  • In early summer of 2020 it was decided to rename the "dev/master" branch to "main". This page provides the instructions to implement that.
  • For context, until this decision, the "dev/master" branch has been the main branch used for synchronizing between the major hubs. The old "master" branch was originally reserved for releases but we have essentially been treating updates to "dev/master" as releases and so we are combining the roles of the old "dev/master" and "master" branches into one branch "main".

For your clones and personal fork, to rename "dev/master" to "main"

First, these instruction assume the remote "origin" refers to your own fork. To check that, from within your clone of MOM6, do

git remote -v

and it should show something like [email protected]:my_github_account/MOM6.git or https://github.com/my_github_account/MOM6.git. If you use multiple remotes and your fork is called something else then use the correct name below in place of "origin".

Do the following the steps from within a clone of the MOM6 repository. You should also do step 1 anywhere else that you have a clone.

  1. Rename the branch locally with
git checkout dev/master
git branch -m dev/master main
  1. Push that to your own fork at GitHub:
git push -u origin main
  1. On the GitHub website, on the page for your fork, under the branches tab, you'll see that you have both "main" and "dev/master". You can safely click the red trash can for "dev/master". If you have a "master" branch you can also delete that now.

Remember to do step 1 anywhere else you have an existing clone. You only need to do steps 2 and 3 once from one clone since this updates your GitHub fork and you only need to do that once.

If you have do not have a personal fork

Assuming your "origin" remote has already renamed "dev/master" to "main" then you need only do

git checkout dev/master
git branch -m dev/master main
git branch --track origin main

You can not do this until the origin has actually renamed their branches.

For more info