Update Git submodule to latest commit on origin

后端 未结 14 1487
清歌不尽
清歌不尽 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条回答
  •  -上瘾入骨i
    2020-11-27 09:11

    In my case, I wanted git to update to the latest and at the same time re-populate any missing files.

    The following restored the missing files (thanks to --force which doesn't seem to have been mentioned here), but it didn't pull any new commits:

    git submodule update --init --recursive --force

    This did:

    git submodule update --recursive --remote --merge --force

提交回复
热议问题