Skip to content

Pulling in code with submodules #1381

Answered by alexveecle
alexveecle asked this question in Q&A
Discussion options

You must be logged in to vote

I have been doing tests that look like:

git fetch $REPO_I_WANT_TO_INCORPORATE $BRANCH_I_WANT_TO_INCORPORATE
josh-filter ':prefix=$PATH_IN_THE_MONO_REPO' FETCH_HEAD
git merge --allow-unrelated FILTERED_HEAD
sed s_foo/bar/_$PATH_IN_THE_REPO/foo/bar/_g <$PATH_IN_THE_MONO_REPO/.gitmodules >>.gitmodules
git commit .gitmodules --amend -F - <<EOF
chore: ...
EOF

, that is, in the merge commit I also modify .gitmodules, appending the external repo's .gitmodules, adjusting the paths (hey, it's a kind of a merge conflict, right?).

This seems to work and does not break further invocations of josh-filter.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alexveecle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant