Easy way to pull latest of all git submodules

前端 未结 19 1608
谎友^
谎友^ 2020-11-22 05:20

We\'re using git submodules to manage a couple of large projects that have dependencies on many other libraries we\'ve developed. Each library is a separate repo brought int

19条回答
  •  名媛妹妹
    2020-11-22 06:01

    On init running the following command:

    git submodule update --init --recursive
    

    from within the git repo directory, works best for me.

    This will pull all latest including submodules.

    Explained

    git - the base command to perform any git command
        submodule - Inspects, updates and manages submodules.
            update - Update the registered submodules to match what the superproject
            expects by cloning missing submodules and updating the working tree of the
            submodules. The "updating" can be done in several ways depending on command
            line options and the value of submodule..update configuration variable.
                --init without the explicit init step if you do not intend to customize
                any submodule locations.
                --recursive is specified, this command will recurse into the registered
                submodules, and update any nested submodules within.
    

    After this you can just run:

    git submodule update --recursive
    

    from within the git repo directory, works best for me.

    This will pull all latest including submodules.

提交回复
热议问题