Much of this is based on https://vivekdhami.com/post/git-move-repo-files-with-history/
- First you need some preliminaries. If you are on a mac, you can do:
brew install git-filter-repo
If you are on discover, do:
module load python/GEOSpyD/Min4.11.0_py3.9 other/git-filter-repo
- Clone the two repos we need
git clone [email protected]:GEOS-ESM/GEOS_OceanGridComp.git
git clone [email protected]:GEOS-ESM/GEOSgcm_GridComp.git
- Checkout the branch in GCM GC
cd GEOSgcm_GridComp
git checkout feature/atrayano/MITgcm-DYAMOND
- Use
filter-repo
to abstract just the Ocean Grid Comp directory
git filter-repo --subdirectory-filter GEOSogcm_GridComp/GEOS_OceanGridComp --force
- Use
filter-repo
to get just the files we care about
git filter-repo --path CMakeLists.txt --path GEOS_OceanGridComp.F90 --path MIT_GEOS5PlugMod --force
- Now we move to the other repo
cd ../GEOS_OceanGridComp
- Add source repo as a remote
git remote add source-repo ../GEOSgcm_GridComp
- Grab the branch we need
git fetch source-repo
...
git branch feature/atrayano/MITgcm-DYAMOND remotes/source-repo/feature/atrayano/MITgcm-DYAMOND
- When you clone
GEOS_OceanGridComp
, you are ondevelop
, so we make a new branch
git checkout -b merge-mitgcm
- Now merge
git merge feature/atrayano/MITgcm-DYAMOND --allow-unrelated-histories
In my testing this threw a couple conflicts:
Auto-merging CMakeLists.txt
CONFLICT (add/add): Merge conflict in CMakeLists.txt
Auto-merging GEOS_OceanGridComp.F90
CONFLICT (add/add): Merge conflict in GEOS_OceanGridComp.F90
Automatic merge failed; fix conflicts and then commit the result.
that need solved.