简体   繁体   English

如何将 git 子模块更新为特定提交?

[英]How to update git submodule to a specific commit?

git submodule update --remote

Above command updates the submodule to latest commit however I want to update to a specific commit (eg to some commit hash).上面的命令将子模块更新为最新的提交,但是我想更新到特定的提交(例如某些提交哈希)。 How to achieve that?如何做到这一点?

git submodules are repositories inside a repository, hence it has the same behavior as any other git repository. git子模块是存储库中的存储库,因此它具有与任何其他git存储库相同的行为。 Hence enter the dependency root by using cd submodule and use any git command.因此,使用cd submodule进入依赖根目录并使用任何 git 命令。

cd submodule
git checkout -b NEW_BRANCH_NAME COMMIT_ID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM