How to set up a git project to use an external repo submodule?

前端 未结 4 1524
清歌不尽
清歌不尽 2020-11-27 08:50

I\'d like to create a repo which pulls in a remote repo.

For example, let\'s say jQuery as a submodule:

git://github.com/jquery/jquery.git

4条回答
  •  臣服心动
    2020-11-27 09:17

    Most of what you need to know has already been answered, so I won't bother addressing that, however, I've found a small piece of information that's usually missing.

    As you know, "git pull" won't update the submodules, and "git submodules update" won't download the latest HEAD of those submodules either.

    To update all of your submodules to their latest upstream revision, you can use

    git submodule foreach git pull
    

    If you often alter your submodules, and have lots of the, then "git foreach" will become invaluable.

提交回复
热议问题