Splitting the repository is the standard way to keep part of a codebase from a contractor, and when the code divides cleanly it is the right one: it is free and needs no vendor. Occlude is for the case where it does not divide cleanly, because the two sides share types and change together.


This page goes through the four ways teams split, what each costs, and how to tell which case you are in.
The four ways to split
| Method | What the contractor gets | What you maintain |
|---|---|---|
| A second repository | A repository holding only their part | A sync in both directions, and an interface between the two |
| Submodules | The outer repository, without access to the inner one | Two commit histories that must be moved in step |
| Subtree | A separate remote for one folder | Splits and merges for that folder |
| Sparse checkout | The whole repository, with most of it not checked out | Nothing. It is not access control |
A second repository
The oldest answer. Copy the contractor's part to its own repository, give them that, and carry changes across. On Stack Overflow, an experienced Git answerer described what he usually sees for contractors on a monorepo:
"I usually see an intermediate gate repository, composed of the relevant parts for the contractor to work, with a synchronization process to import/export to work."
The work is in that last clause. Someone on your team owns the synchronization, and anything the contractor's code calls on the other side has to be published to them as a package or replaced by a stand-in.
Submodules
A submodule keeps a second repository inside the first. Git's own book introduces the idea this way: "you want to be able to treat the two projects as separate yet still be able to use one from within the other."
For access, that means you can leave a contractor without rights to the inner repository. For daily work, it means two histories. A developer on Hacker News described the routine: "When working on both, it's really annoying to have to commit to a dependency's repo, push, and pull down in the dependent repo."
Subtree
A subtree publishes one folder of a repository as a repository of its own. The accepted answer to the monorepo and contractor question on Stack Overflow recommends it: "the contractor would be given access to only the remote repo tied to a single subtree of the monorepo."
It is the tidiest of the three, and it has the same limit. A comment under the same question, from one of the site's best-known Git experts, names it: the subtree approach is "useless unless there's a well-defined subtree."
Sparse checkout
Sparse checkout is often suggested and does not belong on the list. Git's manual describes it as a way to "Reduce your working tree to a subset of tracked files". It makes a large repository lighter to work in. The person still has read access to everything.
It is useful here for one reason: it shows what happens to a build when files are missing. An open issue on Bazel describes it. In a sparse checkout, "source files are not present in the worktree", and a user "has to maintain two independent sources of truth for which files are needed in a build."
Where splitting breaks
All three real methods depend on the same thing: a line through the codebase that few changes cross.
When the line is clean, a mobile app and the service it calls over a documented interface, splitting costs little and you should do it.
When it is not, three things follow.
- The contractor cannot build the real thing. Their code imports types and modules from the side they cannot have, so they build against a stand-in.
- The stand-in drifts. Every change to the protected side has to be reflected in what the contractor builds against, by hand or by a pipeline someone maintains.
- Every crossing change costs twice. One feature becomes two changes in two places, reviewed and merged in order.
This is an old problem. On the Subversion developers' list, years before Git existed, a manager described contractors kept out of part of the source and unable to compile their changes before checking them in. The reply to the question of whether that was really the case was "Believe it or not that was the case."
How Occlude differs
Occlude does not move code between repositories. The repository stays whole. The contractor works in a workspace in your cloud and sees the files their task needs. The compiler, the tests and the dev server see every file.
| Splitting the repository | Occlude | |
|---|---|---|
| Repository layout | Changed to match who may see what | Unchanged |
| The contractor's build | Against stand-ins or published packages | Against the real code |
| A change that crosses the line | Two changes, kept in step | One change |
| Changing who may see what | Move code between repositories | Edit a profile |
| Where the code is | On the contractor's laptop, for their part | In your cloud |
| Cost | Engineering time, no licence | A product to run |
| Maturity | Decades | New |
Which to choose
Split the repository if you can draw the line and most changes stay on one side of it. It is cheaper than Occlude and always will be.
Look at Occlude, which gives outsiders partial repository access by code masking, if you have tried to draw that line and found shared types on both sides, or if you are already paying someone to keep two repositories in step.
Sources
Each quotation was read on its source page on 28 November 2026. Forum, comment and mailing-list quotations are the views of their authors.
- Stack Overflow: Granular access to directories within monorepo, for the three quotations on splitting
- Git Tools: Submodules, Pro Git
- Hacker News, comment on "Why are Git submodules so bad?"
- git-sparse-checkout, the Git manual
- Bazel issue on sparse checkouts
- Subversion developers' list, "Re: Design Questions"
Want to go through this for your codebase?
Or write to contact@occludehq.com
Not ready to talk? Step through a session on a sample repository