This tutorial shows a practical workflow where you:
- vendor an upstream directory into your repo
- add local-only files on top of it
- publish the combined result to your own
origin - later send a clean change back upstream
This tutorial uses a local subdirectory such as vendor/app, because that is the safest supported pattern today.
Assume:
- your repo is the product repo your team owns
- upstream repo contains a reusable app or library
- you want local custom files next to the upstream-managed files
Example local layout after patching:
vendor/app/
README.md
src/
.env
compose.override.yaml
.crossignore
git cross use app https://github.com/example/app.gitThis creates a named upstream alias, here app.
git cross patch app:src vendor/appNow vendor/app contains normal files from the upstream src directory.
Create the local files you need:
touch vendor/app/.env
touch vendor/app/compose.override.yamlThen mark them as local overrides:
cat > vendor/app/.crossignore <<'EOF'
.env
compose.override.yaml
EOFgit cross status
git cross diff vendor/appWhat you should see:
statusreportsOverrideforvendor/appdiffprints manual compare commands for the override paths
This is a deliberate review point.
If a file is local-only, treat it as local-only all the way through your review process.
Your own repo is still just normal Git.
git add vendor/app
git commit -m "Vendor app and keep local overlays"
git push origin mainThis publishes the combined result to your own team repository.
That is separate from contributing changes back to the upstream project.
git cross sync vendor/appThen review again:
git cross status
git cross diff vendor/appEspecially if local-only files live next to upstream-managed files, keep the review loop explicit.
When you want to send a fix upstream, first separate the changes that belong upstream from the changes that belong only in your repo.
The cleanest setup is to track a writable fork from the start, then open a PR or MR from that fork to the original project.
If your current patch points at a read-only upstream remote, switch the tracked remote to your fork before using git cross push.
Before pushing upstream-bound changes:
- review
git cross diff vendor/app - make sure local-only overlay files are not part of what you intend to send upstream
- keep the upstream contribution limited to upstream-managed files
Then push:
git cross push vendor/app --message "Fix parser bug"After that, open a PR or MR from your fork branch to the original upstream project.
- Use your main repo
originfor your final combined product state. - Use a fork remote for upstream contribution.
- Keep local secrets and machine config clearly marked in
.crossignore. - Treat
.crossignoreentries as review helpers, not as permission to stop thinking about what gets pushed.
If you want to try this workflow without giving an agent or tool access to your whole repository, use the repo-local kit:
sbx run opencode --kit ./sbx-kits/opencodeThen mount only the vendored path you want the tool to edit.
See sbx-kits/README.md for the layout.