简体   繁体   中英

Add git submodule to branch of master repository

I want to know that is there any way to add git sub module to branch of master repository. So when i pull the branch code, the sub module should also be checked out?If possible please comment the steps

Yep, it's possible

but:

Submodule is a standalone git project so the code will be checked out to a new folder under the root folder and it's not part of your master branch.

Your root folder will contain a submodule file and you will have to "int && update" it on every clone you make.

# Add the desired submodule ot your code base
git submodule add <url>

You must run two commands:

git submodule init 

to initialize your local configuration file, and

git submodule update 

to fetch all the data from that project and check out the appropriate commit listed in your superproject:

So the full script is this:

git submodule add <url>
git submodule init
git submodule update

在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM