Skip to content

Procedure for merging branches from old regional_workflow repository to ufs srweather app

Michael Kavulich edited this page Sep 9, 2022 · 4 revisions

The first section of this document outlines the step-by-step procedure that will be applied to the ufs-srweather-app repository to complete the merger of the regional_workflow repository. The second section outlines the procedure that users will have to complete in order to bring existing work from their fork of regional_workflow into their fork of ufs-srweather-app.

Procedure for authoritative repository

This procedure was performed on Thursday, September 8; full details on the timeline can be found in the public announcement document.

git clone [email protected]:ufs-community/ufs-srweather-app
git clone [email protected]:ufs-community/regional_workflow
cd regional_workflow
git filter-repo --path ecflow/ --invert-paths
git filter-repo --path fix/ --invert-paths
git filter-repo --path gdas.v15.0.0/ --invert-paths
git filter-repo --path gempak/ --invert-paths
git filter-repo --path gfs.v15.0.0/ --invert-paths
git filter-repo --path gfs_workflow.v15.0.0/ --invert-paths
git filter-repo --path global_shared.v15.0.0/ --invert-paths
git filter-repo --path sorc/ --invert-paths
git filter-repo --path util/ --invert-paths

These “git filter-repo” commands are not part of the merge; this is an opportunistic cleanup operation being performed as described in the public notice document

cd ../ufs-srweather-app/
git remote add rw ../regional_workflow
git fetch rw
git merge rw/develop --allow-unrelated-histories
git push

This constitutes the completion of the command-line procedure. The regional_workflow develop branch (with its git history and directory structure) are now merged into the ufs-srweather-app develop branch, and the former is now obsolete and frozen. The remainder of the changes necessary to account for the new directory structure were applied via PR: https://github.com/ufs-community/ufs-srweather-app/pull/343

Procedure for user forks

Users who have existing work in a branch of their regional_workflow fork need not despair: this procedure details the process of moving existing work from a branch in a user fork of regional_workflow into the same user’s fork of ufs-srweather-app. These instructions are much the same that will be performed on the main repository, but with extra steps to ensure no data is lost, as well as resolving merge conflicts.

Important steps prior to starting

  1. If you do not have any existing work from branches in your regional_workflow fork, you do not need to take any special action. Simply update your ufs-srweather-app fork from the main repository as you would normally.

  2. If your changes in regional_workflow are simple, it will likely be quicker just to re-apply them in a new ufs-srweather-app branch

  3. Prior to this procedure you should update the develop branch of your ufs-srweather-app fork from the main repository; you should be able to do this through the GitHub web interface by visiting your fork's URL (https://github.com/your_fork_name/ufs-srweather-app).

    • Screenshot of fork page, with "sync fork" option highlighted
  4. Do not be intimidated by the number of commands. Most of these are either for general repository cleanup, or safety to ensure that you do not lose any work.

  5. Users whose changes include any of the following files will need to manually apply their changes. Contact [email protected] if you have questions:

  • .github/CODEOWNERS
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/feature_request.md
  • .github/PULL_REQUEST_TEMPLATE
  • LICENSE.md
  • README.md

Procedure

export fork_name=your_github_username
  • tcsh shell users should stop using tcsh. But if that's not an option, substitute the appropriate "setenv" command here to set these environment variables.
  • Users should insert their own github username here
git clone [email protected]:${fork_name}/ufs-srweather-app
git clone [email protected]:${fork_name}/regional_workflow
  • This is the procedure for cloning with SSH, can be cloned through HTTPS as well if you haven't set that up
mkdir backups/
tar -cf backups/ufs-srweather-app.tar ufs-srweather-app
tar -cf backups/regional_workflow.tar regional_workflow
  • Ideally it should be impossible to mess things up too badly, but just in case, it's always a good idea to clone backups of your repositories when outside of your comfort zone.
cd regional_workflow
git filter-repo --path ecflow/ --invert-paths
git filter-repo --path fix/ --invert-paths
git filter-repo --path gdas.v15.0.0/ --invert-paths
git filter-repo --path gempak/ --invert-paths
git filter-repo --path gfs.v15.0.0/ --invert-paths
git filter-repo --path gfs_workflow.v15.0.0/ --invert-paths
git filter-repo --path global_shared.v15.0.0/ --invert-paths
git filter-repo --path sorc/ --invert-paths
git filter-repo --path util/ --invert-paths
cd ../ufs-srweather-app/
export branch_to_merge=branchname
  • Replace "branchname" with the branch you wish to bring over from your regional_workflow fork.
git checkout 032afc2b
  • For reference, 032afc2b is the commit in ufs-srweather-app right before the merge
git checkout -b $branch_to_merge
git remote add rw ../regional_workflow
git fetch rw
git merge rw/$branch_to_merge --allow-unrelated-histories -Xours
  • The -Xours flag used in the above command indicates that merge conflicts should be ignored, and the ufs-srweather-app version of conflicting files should be kept. Users whose changes include any of the following files will need to manually apply their changes:
    • .github/CODEOWNERS
    • .github/ISSUE_TEMPLATE/bug_report.md
    • .github/ISSUE_TEMPLATE/feature_request.md
    • .github/PULL_REQUEST_TEMPLATE
    • LICENSE.md
    • README.md
  • More information on conflicts available in Public notice: merger of regional_workflow and ufs-srweather-app repositories
git cherry-pick 30adef2
git push
  • You may be prompted by git to use the --set-upstream; if this happens use the suggested git push command printed on the screen.

Your fork’s branch(es) is (are) now up-to-date with the main, combined ufs-srweather-app repository. If you have development in one or both of your forks that you need to continue going forward, simply re-run all the commands starting from the line export branch_to_merge=branchname

Acknowledgements

This document was authored by Michael Kavulich (@mkavulich); contact him with any questions. Special thanks to Daniel Abdi for his testing and comments on the user fork procedure, and Christina Holt, Venita Hagerty, and Mark Potts for their work and feedback in migrating automated testing to the new repository.