-1

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

Chinar123
  • 1
  • 1
  • 1
    Possible duplicate of [How to \`git clone\` including submodules?](http://stackoverflow.com/questions/3796927/how-to-git-clone-including-submodules) – Maks3w Mar 06 '16 at 11:17

1 Answers1

0

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

enter image description here

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167