Recursive Git push/pull?

后端 未结 5 1656
迷失自我
迷失自我 2021-02-02 10:21

I have a git repository that contains other git repositories. Are there commands that recursively push and/or pull for not only the meta-repository but the sub-repositories?

5条回答
  •  花落未央
    2021-02-02 11:05

    Not quite git pull, but close:

    git fetch --recurse-submodules
    

    From the Git docs:

    --recurse-submodules[=yes|on-demand|no]

    This option controls if and under what conditions new commits of populated submodules should be fetched too. It can be used as a boolean option to completely disable recursion when set to no or to unconditionally recurse into all populated submodules when set to yes, which is the default when this option is used without any value. Use on-demand to only recurse into a populated submodule when the superproject retrieves a commit that updates the submodule’s reference to a commit that isn’t already in the local submodule clone.

提交回复
热议问题