git-cross lets you borrow part of another repository without turning that repository into a submodule inside yours.
It does that by keeping:
- a hidden worktree with real upstream Git state
- a local copied directory with normal files in your repo
- a
Crossfilethat records how the setup was created
The local directory is what you edit. The worktree is what git-cross uses to sync, diff, and push.
Each patch has four coordinates:
- remote alias, for example
demo - upstream branch, for example
main - upstream path, for example
src/lib - local path, for example
vendor/lib
You can think of one patch as:
upstream repo:path <-> hidden worktree:path <-> local directory
Human-readable replay log.
Example:
cross use demo https://github.com/example/demo.git
cross patch demo:main:src/lib vendor/libHidden worktrees keyed by remote plus hash.
They hold upstream Git state and make sync, diff, and push possible without turning your vendored directory into another Git repository.
Internal patch registry.
It records the relationship between remote path, local path, worktree path, and branch.
Adds a named remote and detects the default branch.
Creates or reuses a hidden worktree, sparse-checks out the requested upstream path, and syncs it into the local directory.
Updates from upstream into the local directory.
Compares local files with the hidden worktree copy.
Summarizes local modifications, upstream ahead/behind state, and conflict markers.
Copies local changes back into the hidden worktree, commits there, and pushes to the configured upstream remote.
Reconstructs the environment from Crossfile.
Remove patch metadata, clean worktrees, and avoid unsafe deletion of repo-root content.
Primary implementation.
Use this if you want the main supported binary.
Reference implementation.
Use this when you want the clearest behavior or fastest iteration inside the repo.
Experimental parity implementation.
Useful for contributors and parity testing, but not the default recommendation for general users yet.
One practical pattern is to keep local-only files next to upstream-managed files.
Example:
vendor/app/
README.md # upstream-managed
src/... # upstream-managed
.env # local-only
compose.override.yaml # local-only
.crossignore
With:
.env
compose.override.yaml
Current shipped behavior:
statusshowsOverridediffprints manual compare commands for those override paths
This gives you a visible review surface without pretending that local-only files are safe to push blindly.
git-cross is built around a few conservative ideas:
- keep upstream Git state separate from your main repo
- keep local files editable as plain files
- prefer explicit review over hidden automation around local-only files
- avoid deleting repo-root contents during cleanup commands
Important current boundary:
- override markers are currently a review aid in
statusanddiff - if a file must never be sent upstream, review it explicitly before
push
- Patch an upstream directory into
vendor/... - Edit files locally as normal
- Commit the combined result to your own repo
- Pull upstream changes later with
sync - Push upstream-safe changes back with
git cross push - Open a PR or MR from the pushed branch if needed
git-cross works well with AI tools because vendored content is plain files.
That means you can:
- mount only
vendor/libinto a sandbox - keep
.gitand hidden worktrees on the host - review AI changes with
git cross diff - publish upstream-safe changes with
git cross push
See:
sbx-kits/README.mddocs/tutorials/local-overlays-and-upstream.md
This repository ships role guidance for AI tools:
.agents/for shared role definitions.claude/for Claude entrypoints.opencode/skills/for OpenCode-native skills
The main roles are:
- maintainer
- feature spec writer
- safety reviewer
- regression tester