Home  >  Q&A  >  body text

请问如何更新git项目中的submodle

请教一个问题,a项目中有一个submodle:b,submodle:b更新后,在a项目中执行

git fetch origin
git submodule update

可是a项目中的submodle:b并未更新,求解?

黄舟黄舟2726 days ago551

reply all(3)I'll reply

  • 漂亮男人

    漂亮男人2017-05-02 09:20:13

    This is the deployment script currently used in our project, FYI
    git submodule init
    git submodule update
    git submodule foreach 'git pull'

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:20:13

    Execute git submodule init first
    Then git submodule update

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:20:13

    Clone project with submodule:

    git clone --recursive <remote-url>
    

    Reference

    Update project with submodule:

    git submodule update --remote
    

    Reference

    Modify submodule locally.
    Before making any modifications, since the submodule is in the detached state, you need to enter the directory of the submodule and switch to a branch. git checkout <branch-name> If you make any changes later, just commit them in the submodule directory.
    Afterwards, when updating the submodule, it can be executed in the repo directory:

    git submodule update --remote --rebase
    

    or

    git submodule update --remote --merge
    

    reply
    0
  • Cancelreply