Update Git submodule to latest commit on origin

后端 未结 14 1496
清歌不尽
清歌不尽 2020-11-27 09:02

I have a project with a Git submodule. It is from an ssh://... URL, and is on commit A. Commit B has been pushed to that URL, and I want the submodule to retrieve the commit

14条回答
  •  难免孤独
    2020-11-27 09:16

    If you don't know the host branch, make this:

    git submodule foreach git pull origin $(git rev-parse --abbrev-ref HEAD)
    

    It will get a branch of the main Git repository and then for each submodule will make a pull of the same branch.

提交回复
热议问题