Git submodule (reprint)

Source: Internet
Author: User
Tags using git

From:http://www.worldhello.net/2010/01/26/425.html

There are two scenarios for deleting git submodule (Git library sub-module) to create Git submodule (Git sub-module)
    • Explicit add: Use the git submodule command to add other git libraries as subdirectories, which are sub-modules
    • Implicit add: Add using git Add, if a subdirectory itself is a git library, it is automatically added as a sub-module, no longer recursively add files under that directory
So what's the difference between the two ways of adding a sub-module? What are the side effects of sub-modules? How do I delete a module? Two ways to add a module, the effect is slightly different
    • Implicit way to add, it seems that the directory is directly added to the repository, but in fact, add a directory name with the same name of the submodule entry;
    • Explicitly added, in addition to creating an submodule entry in Index/commit as an implicit way, a. gitmodules file is created, and the corresponding record is created in. Git/config. See the git submodule command for details.
Side effects of sub-modulesSometimes it is not realized that the directory is added as a module. For example, when backing up files and directories with Gistore, when a directory itself is versioned with Git, the directory is added as a sub-module. How do I add a sub-module to a version control system in the normal directory format? Do not do this in the following way:
    • Delete the. Git directory of the sub-module and delete the Git repository under the sub-module
    • When executing git add times error: Fatal:path ' ... ' is in submodule ' ... '
So, what should we do? How to delete a sub-module 使用 git 命令即可删除子模组
git rm --cached path/to/submodule
for explicitly defined sub-modules, also delete the. gitmodules file and the associated entry in the. git/config file.

Git submodule (reprint)

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: info-contact@alibabacloud.com 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.