如何使用"git submodule"签出特定版本的子模块? [英] How do I check out a specific version of a submodule using 'git submodule'?

查看:1175
本文介绍了如何使用"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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆