This tutorial shows how to vendor an entire upstream repository into a local directory such as vendor/upstream-app.
Use this when:
- you want the whole upstream tree, not just one subdirectory
- you still want normal files in your repository
- you want to pull updates later or send changes back upstream
This tutorial vendors the whole upstream into a local directory, not into repo root.
Assume you want to embed the complete contents of an upstream repository into:
vendor/upstream-app
That keeps the workflow simple and keeps cleanup safer than a repo-root experiment.
git cross use app https://github.com/example/app.gitYou can use either :. or :/.
git cross patch app:. vendor/upstream-appEquivalent form:
git cross patch app:/ vendor/upstream-appAfter that, vendor/upstream-app contains the full upstream checkout as normal files.
git cross status
git cross diff vendor/upstream-appAt this point the patch should normally be Clean and Synced.
Edit files under vendor/upstream-app as needed.
For example:
printf '\nlocal customization\n' >> vendor/upstream-app/README.mdReview the result:
git cross diff vendor/upstream-appIf you need machine-local or product-local files alongside the imported tree, create them locally and mark them in .crossignore.
Example:
touch vendor/upstream-app/.env
cat > vendor/upstream-app/.crossignore <<'EOF'
.env
EOFCurrent behavior:
git cross statusreportsOverridegit cross diff vendor/upstream-appprints a manual compare command for.env
Treat this as a review aid. Local-only files still need human review before any upstream push.
git cross sync vendor/upstream-appThen review again:
git cross status
git cross diff vendor/upstream-appYour own product repository is still plain Git:
git add vendor/upstream-app
git commit -m "Update vendored upstream app"
git push origin mainIf some of your changes belong upstream:
- review
git cross diff vendor/upstream-app - make sure local-only files are not part of the upstream contribution
- prefer tracking a writable fork for the patch remote
Then push:
git cross push vendor/upstream-app --message "Fix upstream issue"After that, open a PR or MR from your fork branch to the original project.
Use whole-upstream vendoring when:
- the upstream project is small enough to vendor completely
- you need several directories from the upstream project together
- the upstream build or runtime layout assumes repo-wide paths
Use a subdirectory patch when:
- you only need one component
- you want a smaller local footprint
- you want AI or sandbox tooling scoped to a smaller subtree