Skip to content

Commit e1fb5bf

Browse files
authored
Merge pull request #16 from mononen/contributing-with-submodules
2 parents 499ec6f + ffc85ef commit e1fb5bf

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,89 @@ Unsure where to start? Look for issues tagged with `good first issue`—these ar
3737
- **Testing**: Adding tests for new features or fixing bugs increases the stability of Omniview. We love tests!
3838
- **Documentation**: If your changes need documentation, please update it. Good documentation is key to user adoption.
3939

40+
## Working with Forks and Submodules
41+
42+
Omniview uses Git submodules for first-party plugins (e.g. `plugins/kubernetes`). If you're developing across a fork of the parent repo **and** a fork of a plugin, follow this workflow carefully to avoid polluting PRs with submodule URL changes.
43+
44+
### Repository layout
45+
46+
| Repo | Canonical location |
47+
|------|--------------------|
48+
| Parent app | `github.com/omniviewdev/omniview` |
49+
| Kubernetes plugin | `github.com/omniviewdev/omniview-plugin-kubernetes` |
50+
51+
### Setting up your forks locally
52+
53+
After cloning your fork of the parent repo, the submodule will point to the canonical upstream URL (as defined in `.gitmodules`). Add your plugin fork as a second remote inside the submodule so you can push feature branches there:
54+
55+
```bash
56+
cd plugins/kubernetes
57+
git remote add upstream git@github.com:omniviewdev/omniview-plugin-kubernetes.git
58+
# "origin" already points to the canonical upstream after a normal clone
59+
# add your fork as a push target:
60+
git remote set-url --push origin git@github.com:<your-username>/omniview-plugin-kubernetes.git
61+
```
62+
63+
To redirect your local checkout to pull from your fork without touching `.gitmodules` (which is committed and shared):
64+
65+
```bash
66+
# Run from the root of the parent repo
67+
git config submodule.plugins/kubernetes.url git@github.com:<your-username>/omniview-plugin-kubernetes.git
68+
```
69+
70+
This writes only to your local `.git/config` and is never committed.
71+
72+
### Developing a plugin change
73+
74+
1. Branch off your plugin fork, do your work, push to your fork, open a PR to `omniviewdev/omniview-plugin-kubernetes`.
75+
2. While waiting for the plugin PR to merge you can point your local submodule at your feature branch commit for integration testing — but **never commit a `.gitmodules` change** that points to a personal fork.
76+
3. Once the plugin PR is merged, advance the submodule pointer in the parent repo:
77+
78+
```bash
79+
cd plugins/kubernetes
80+
git fetch upstream
81+
git checkout upstream/main
82+
83+
cd ..
84+
git add plugins/kubernetes
85+
git commit -m "chore: update kubernetes submodule to upstream main (<short-sha>)"
86+
```
87+
88+
4. Open a PR to `omniviewdev/omniview` with just the submodule pointer bump.
89+
90+
### Syncing your fork after upstream merges
91+
92+
After any PR is merged into the upstream parent repo, sync your fork's `main`:
93+
94+
```bash
95+
git fetch upstream
96+
git merge upstream/main
97+
git push origin main
98+
```
99+
100+
Then check the submodule too — if `git submodule status` shows a `-` or `+` prefix the pointer is out of sync:
101+
102+
```bash
103+
cd plugins/kubernetes
104+
git fetch upstream
105+
git checkout upstream/main
106+
107+
cd ..
108+
git add plugins/kubernetes
109+
git commit -m "chore: update kubernetes submodule to upstream main (<short-sha>)"
110+
git push origin main
111+
```
112+
113+
### The rule that prevents collisions
114+
115+
> **`.gitmodules` must always reference the canonical upstream URL.** Never open a PR that changes a submodule URL to a personal fork. Use `git config submodule.<path>.url` for local overrides — these live in `.git/config` and are never committed.
116+
117+
To reset a local override back to the canonical URL at any time:
118+
119+
```bash
120+
git submodule sync
121+
```
122+
40123
## Signing the CLA
41124

42125
Before we can accept your contributions, you'll need to sign a Contributor License Agreement (CLA). This helps ensure that the community can always use your contributions.

0 commit comments

Comments
 (0)