You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Update the submodule reference** in your `go-api` PR.
42
42
- In the corresponding **`go-api` Pull Request**, include the link to the `go-api-artifacts` PR as a *related PR* so reviewers can track both changes together.
43
+
44
+
## Submodule Pointer Workflow
45
+
46
+
Keep CI green by ensuring the parent repo points to a submodule commit that exists on the remote.
47
+
48
+
- Update submodule content and push:
49
+
```bash
50
+
cd assets
51
+
git checkout -b update-artifacts
52
+
# make changes (e.g., regenerate schema)
53
+
git add -A
54
+
git commit -m "Update artifacts"
55
+
git push origin update-artifacts
56
+
# open PR in IFRCGo/go-api-artifacts and merge to main
57
+
git checkout main && git pull
58
+
cd -
59
+
```
60
+
- Record new submodule commit in parent:
61
+
```bash
62
+
# ensure the submodule worktree is on the merged commit
63
+
cd assets && git checkout main && git pull &&cd -
64
+
git add assets
65
+
git commit -m "Update assets submodule pointer"
66
+
git push origin <your-go-api-branch>
67
+
```
68
+
- GitHub Actions checkout settings (recommended):
69
+
```yaml
70
+
- uses: actions/checkout@v4
71
+
with:
72
+
fetch-depth: 0
73
+
submodules: recursive
74
+
```
75
+
76
+
Notes
77
+
- Avoid amending/rebasing submodule commits that the parent already references; make a new commit instead.
78
+
- Ensure submodule commit is on `origin/main` (or a ref CI can fetch) before updating the parent pointer.
79
+
80
+
## Submodule Commands Cheat Sheet
81
+
82
+
Common commands you’ll use with `assets` submodule:
83
+
84
+
- Initialize submodules after clone:
85
+
```bash
86
+
git submodule update --init --recursive
87
+
```
88
+
- Sync `.gitmodules` config to local submodule metadata:
89
+
```bash
90
+
git submodule sync
91
+
```
92
+
- Check the submodule commit pointer:
93
+
```bash
94
+
git submodule status
95
+
```
96
+
- Move submodule to latest commit from its remote tracking branch:
97
+
```bash
98
+
git submodule update --remote assets
99
+
git add assets
100
+
git commit -m "Sync assets to latest remote commit"
101
+
```
102
+
- Pin submodule to a specific commit (e.g., after checkout):
103
+
```bash
104
+
cd assets
105
+
git checkout <commit-or-branch>
106
+
cd -
107
+
git add assets
108
+
git commit -m "Update assets submodule pointer"
109
+
```
110
+
- Switch submodule remote to SSH (avoid HTTPS prompts):
0 commit comments