Can git submodule update be made to fetch tags in submodules?

后端 未结 4 950
慢半拍i
慢半拍i 2021-02-04 02:57

I have a git repository which uses a submodule which I\'d like to point at an annotated tag, but when I do git submodule update new tags don\'t get fetched. I can g

4条回答
  •  时光说笑
    2021-02-04 03:21

    git submodule update doesn't fetch anything if your submodules are up-to-date. So this might be a misapprehension.

    git submodule update will bring the working directory contents of the submodules in your repository to the defined state (i.e. check out the submodule commit that has been defined in your repository).

    A better way would be to cd into your submodule (which is a Git repository itself) and simply run git fetch --tags and then git checkout some-tag. After that the submodule has been updated in your working directory to some-tag and you can stage it for committing.

提交回复
热议问题