2

We have multiple GIT repos and have requirement of including one subdirectory from different repo while cloning the main GIT repo. Example: When I clone repo_1 it also should clone repo_2:/src/dev So, only one clone command will be executed "git clone -b master repo_1." and it also should clone repo_2:/src/dev directory at the same time.

Is this possible to do in GIT?

1 Answer 1

1

It is through submodules, where repo1 can reference a specific commit of repo2, which will be checked out as a subdirectory of repo1.
Using a script like Reedbeta/git-partial-submodule can help making sure repo2 is using a sparse checkout, in order to deliver only its src/dev content instead of the full repository.

What is not possible, as far as I know, is to have both repositories checked out in the same local folder.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.