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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.