如何使用git子模块检查子模块的特定版本? [英] How to check out specific version of a submodule using git submodule?

查看:2332
本文介绍了如何使用git子模块检查子模块的特定版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

子模块存储库保持分离HEAD状态指向特定的提交。更改该提交只需检出一个不同的标记或提交,然后将更改添加到父存储库。

  $ cd submodule 
$ git checkout v2.0
以前的HEAD位置是5c1277e ...碰撞版本为2.0.5
HEAD现在在f0a0036 ...版本2.0

git-status 现在会报告一个脏树:

 #分支开发[...] 

#修改:子模块(新提交)

添加子模块目录并提交以存储新指针。


How would I go about adding a git submodule for a specific tag or commit?

解决方案

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 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子模块检查子模块的特定版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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