Skip to content

Updating the MOM6 component

Denise Worthen edited this page Jan 17, 2020 · 12 revisions

Because the MOM6 component in ufs-s2s-model consists of multiple submodules, creating a branch for development work can be tricky. Experience has shown that is usually best to first create the MOM6-interface branch separately and then update the ufs-s2s-model fork to use it rather than trying to create the MOM6-interface branch directly in the ufs-s2s-model fork.

The following steps will show how Jane can create a branch of the MOM6-interface which will use a feature branch of her MOM6 fork. Jane can then create a ufs-s2s-model branch which uses this MOM6 feature branch contained in her MOM6-interface fork.

Creating a MOM6-interface branch

  1. Jane first makes sure her fork of MOM6-interface is up-to-date with the NOAA-EMC repository. Then she checks out her MOM6-interface into a WORK area and creates a branch which will contain her feature in the MOM6 repo.
git clone [email protected]:JaneSmith/MOM6-interface.git WORK
git submodule update --init --recursive
git checkout -b feature/mom6_interface_with_MOM6feature
  1. Jane then adds her fork of the MOM6 repository, fetches it, and points to her feature branch.
cd src/MOM6
git remote add JS [email protected]:JaneSmith/MOM6.git
git fetch JS
git checkout feature/MOM6feature
  1. Jane now needs to return to the top of WORK directory, sync the submodules for the new MOM6 fork within the MOM6-interface and edit the .gitmodules:
cd ../../
git submodule sync
[submodule "src/MOM6"]
        path = src/MOM6
        url = https://github.com/JaneSmith/MOM6
[submodule "src/mkmf"]
        path = src/mkmf
        url = https://github.com/NOAA-EMC/mkmf
  1. A git status will now show that both .gitmodules and src/MOM6 have changed. Committing the result should result in the feature/mom6_interface_with_MOM6feature branch in Jane's MOM6-interface fork. It will be pointing to her feature/MOM6feature branch in the MOM6 submodule.
git add src/MOM6
git add .gitmodules
git push --set-upstream origin feature/mom6_interface_with_MOM6feature

Updating ufs-s2s-model to use a new MOM6-interface branch

  1. After cloning her fork of the ufs-s2s-model into a working area WORK, Jane creates a branch of ufs-s2s-model which will contain her branch for the MOM6-interface containing her MOM6 feature branch.
git clone [email protected]:JaneSmith/ufs-s2s-model.git WORK
cd WORK
git submodule update --init --recursive
git checkout -b feature/s2s_with_MOM6feature
  1. Jane edits the .gitmodules to point to her MOM6-interface fork and then syncs the submodules:
[submodule "MOM6"]
        path = MOM6
        url = https://github.com/JaneSmith/MOM6-interface
git submodule sync
  1. Changing into the MOM6 subdirectory and checking the remote should confirm that the MOM6-interface is using Jane's MOM6-interface fork:
cd MOM6
git remote -v
origin	https://github.com/JaneSmith/MOM6-interface (fetch)
origin	https://github.com/JaneSmith/MOM6-interface (push)

and git fetch will bring in Jane's MOM6-interface branches and allow her to check out feature/mom6_interface_with_MOM6feature which contains her MOM6 fork with the feature/MOM6feature branch:

git fetch
git checkout feature/mom6_interface_with_MOM6feature
  1. git status at the top of WORK will show that both .gitmodules and src/MOM6 have new commits. Jane can now add and commit her feature/s2s_with_MOM6feature to her ufs-s2s-fork
git add MOM6
git add .gitmodules
git commit
git push --set-upstream origin feature/s2s_with_MOM6feature

Jane's ufs-s2s-model fork should now contain a branch feature/s2s_with_MOM6feature which points to her MOM6feature branch in her MOM6-interface fork.

Jane then double checks her work by doing a test checkout of her ufs-s2s repository to confirm that the MOM6 hash corresponds to the hash of her feature/MOM6feature branch in her MOM6 fork.

Clone this wiki locally