How to exclude a specific git submodule from update?

后端 未结 1 881
野趣味
野趣味 2020-12-19 02:37

I have list of submodules in .gitmodules. I want to download a specific submodule i.e grpc only if there is some option enabled as true in config file. Since grpc is not re

1条回答
  •  隐瞒了意图╮
    2020-12-19 03:04

    From the git help:

    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. Supported update procedures are:

    ...

    ...

    When no option is given and submodule..update is set to none, the submodule is not updated.

    So set update = none in the configuration file. You can also explicitly give paths after -- to only update specific submodules. To do this on the fly and not change your configuration file, @PrashantShubham notes you can:

    git -c submodule."third-party/grpc".update=none submodule update --init --recursive
    

    0 讨论(0)
提交回复
热议问题