Sinsing analysis of submodule in Git

Source: Internet
Author: User
Tags using git

Sometimes, we need to extract some common parts into a common library, which can be used for other projects, and the version management of public code libraries is cumbersome. We can use submodule in git to do this.

1. Add

Add Submodule to the current project, the command format is: Git submodule add warehouse address path

After the addition is complete, a file named ". Gitmodules" is generated under the current project path, which records the submodule information and adds the folder where the submodule resides to the project.

2. Delete

To remove Submodule, we first delete the appropriate configuration information in the. gitmodules file, and then execute the git rm-cached command to remove the file from Git from your submodule.

3. Update

We can update submodules using git submodule update.

4 . Note

When using Git clone down the project with Submodule, the initial time, submodule content will not be downloaded automatically, we do git submodule update--init--recursive.

Sinsing analysis of submodule in Git

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.