forked from NOAA-GFDL/MOM6-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_notes
More file actions
67 lines (44 loc) · 2.29 KB
/
Copy pathgit_notes
File metadata and controls
67 lines (44 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Getting the repo running with the submodules was a moderate pain. Because I will definitely forget all this, the following had to be done:
On github, make forks of the MOM6-examples repo as well as the MOM6, SIS2 and FMS repo (these are the submodules).
At that point, clone the MOM6-examples repo (make sure to use SSH! github doesn't allow access via anything but SSH keys/ tokens):
git clone git@github.com:whuiskamp/MOM6-examples.git
Update the configuration file in .gitmodules to link to your forked repos:
[submodule "src/MOM6"]
path = src/MOM6
url = https://github.com/whuiskamp/MOM6.git
[submodule "src/SIS2"]
path = src/SIS2
url = https://github.com/whuiskamp/SIS2.git
[submodule "src/coupler"]
path = src/coupler
url = https://github.com/whuiskamp/FMScoupler
Now we can initialise our submodules:
cd MOM6-examples
git submodule init src/MOM6
git submodule init src/SIS2
git submodule init src/coupler
cd src/MOM6
git checkout dev/gfdl
cd ../../src/SIS2
git checkout dev/gfdl
cd ../../src/coupler
git checkout main
Same has to be done for mkmf
At this point, there is often the problem of the HEADS of the submodules being detached (though this should have been fixed by manually checking out the repo previously). Following the solutions shown here: https://stackoverflow.com/questions/18770545/why-is-my-git-submodule-head-detached-from-master/55570998#55570998
I've created an alias as follows:
git config alias.supdate 'submodule update --remote --merge'
So now, in order to update our submodules all we have to do is run:
git supdate src/coupler (or MOM6,SIS2)
This will sometimes still result in an error (for example, the coupler is currently returning:
fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'src/coupler'
)
That's on the to-do list... but can also just be ignored with a git pull in the actual submodule dir (?!)
For the submodules we do not intend to edit, we still need to initialise and check these out:
git submodule init src/atmos_null (etc... do this for all of them)
then go to main repo and run:
git pull --recurse-submodules
Finally, we also need to include the files in src/MOM6/pkg/GSW--Fortran/
cd src/MOM6
git submodule init pkg/GSW-Fortran
git submodule update pkg/GSW-Fortran