[Discussion] Recommended way to handle many submodules in worktrunk worktrees? Considering nested git worktrees
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- git
- Domain
- cli, developer-experience
Research direction
Start by reading the linked issues #1194, #1196, #777, and #1069, then compare the described nested-worktree approach with the standard git submodule update --init flow. The issue names no files or tests and asks for guidance rather than a specific change, so there is no implementation target or completion criterion yet.
Written by the indexing model from the issue text.
Description
Context
We use worktrunk on a large Gradle-based project with 25 git submodules. ~9 are libraries we maintain (read access); ~14 are private to other teams and we substitute prebuilt artifacts via Gradle's dependencySubstitution. The standard flow — wt switch --create followed by git submodule update --init — takes several minutes per new worktree because each submodule is re-cloned from the remote.
Pattern we're considering
Instead of re-initializing, use nested git worktree add: for each permitted submodule, run git worktree add $WT/$sub <commit> from inside $BASE/$sub. This produces a second worktree of the submodule, rooted at the parent worktree's submodule path — same mechanism that makes parent-repo worktrees instant. No network, no object duplication.
Start commit defaults to the parent worktree's index entry for that submodule (git rev-parse HEAD:$sub), which keeps parent's git status clean.
Rough numbers from a one-off test
Standard submodule update --init |
Nested worktree | |
|---|---|---|
| 9-submodule init | minutes (network-bound) | ~2s |
Extra disk for .git data |
several GB | ~0 (gitfiles only) |
| Full Gradle build + install | works | works |
Tradeoffs we've already spotted
wt removeneeds--forcebecause detaching the nested submodule worktrees first leaves parent'sgit statuswithDentries.git submodule deinit/git submodule absorbgitdirsbecome dangerous in this workflow — they would manipulate the shared git dir that base and all worktrees rely on.
What we'd like input on
Before committing to this pattern, we'd appreciate hearing:
- Has anyone shipped nested-worktree-as-submodule in a real workflow? Any non-obvious failure modes (git upgrades, gc/prune on shared git dirs, IDE integrations)?
- Is there a reason the worktrunk team has steered away from documenting this? Closed issues #1194 / #1196 / #777 / #1069 all focus on standard
git submodulesemantics; we couldn't find any nested-worktree mention. - What's the recommended way to handle many submodules in worktrunk worktrees today? If the standard
update --initflow is considered acceptable despite the speed cost, we'd like to hear why — there may be safety properties we're under-valuing.
Mostly looking for guidance from anyone who's been here before. Happy to go with the standard approach if there's a strong reason to.
- Dominant language
- Rust
- Stars
- 8.8k
- Forks
- 315
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 204
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from max-sixty/worktrunk
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
max-sixty/worktrunk#4727 · 7 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
max-sixty/worktrunk#4260 · 5 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
max-sixty/worktrunk#3847 · 1 comment ·
Maintainers usually reply within 1 day
-
`wt step` confusionOpen
Difficulty 5/5 Over a week Newbie friendliness 28/100
max-sixty/worktrunk#4728 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
max-sixty/worktrunk#4718 · 1 comment ·
Maintainers usually reply within 1 day
All issues in max-sixty/worktrunk
Similar issues
-
needs-triage tooling
Difficulty 1/5 Under an hour Newbie friendliness 90/100
neilsh/stunt-reel#317 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
storytold/craft-fonts#65 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
storytold/craft-libs#723 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
n0-computer/iroh#4669 · 1 comment ·
Maintainers usually reply within 1 day