Easy way to pull latest of all git submodules

前端 未结 19 1906
谎友^
谎友^ 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 05:38

    I did this by adapting gahooa's answer above:

    Integrate it with a git [alias] ...

    If your parent project has something like this in .gitmodules:

    [submodule "opt/submodules/solarized"]
        path = opt/submodules/solarized
        url = git@github.com:altercation/solarized.git
    [submodule "opt/submodules/intellij-colors-solarized"]
        path = opt/submodules/intellij-colors-solarized
        url = git@github.com:jkaving/intellij-colors-solarized.git
    

    Add something like this inside your .gitconfig

    [alias]
        updatesubs = "!sh -c \"git submodule init && git submodule update && git submodule status\" "
    

    Then to update your submodules, run:

    git updatesubs
    

    I have an example of it in my environment setup repo.

提交回复
热议问题