如何使用“git submodule"检查子模块的特定版本? [英] How do I check out a specific version of a submodule using 'git submodule'?
本文介绍了如何使用“git submodule"检查子模块的特定版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何为特定标签或提交添加 Git 子模块?
How would I go about adding a Git submodule for a specific tag or commit?
推荐答案
子模块存储库保持分离的 HEAD 状态,指向特定的提交.更改提交只涉及签出不同的标记或提交,然后将更改添加到父存储库.
Submodule repositories stay in a detached HEAD state pointing to a specific commit. Changing that commit simply involves checking out a different tag or commit then adding the change to the parent repository.
$ cd submodule
$ git checkout v2.0
Previous HEAD position was 5c1277e... bumped version to 2.0.5
HEAD is now at f0a0036... version 2.0
父存储库上的
git-status
现在将报告一个脏树:
git-status
on the parent repository will now report a dirty tree:
# On branch dev [...]
#
# modified: submodule (new commits)
添加子模块目录并提交存储新指针.
Add the submodule directory and commit to store the new pointer.
这篇关于如何使用“git submodule"检查子模块的特定版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文