首页 > 解决方案 > 使用特定的提交号添加 git 子模块

问题描述

我正在使用 git submodule 命令在我的项目中添加这个 FSM 存储库。我想检查一个特定的发布提交。默认情况下,主分支已签出。添加 git repo 后,当我运行时

$ git submodule

它给

d1b66d66cfa95f238a7498465908a262f4b2326a directory_path/fsmlite

这里的提交号属于一个主分支提交。如何使用其提交号签出另一个提交?

标签: git-submodules

解决方案


可能还有其他方法可以做到这一点,但我得到了所需的提交

$ cd directory_path/fsmlite 
$ git checkout v0.7.1      (this is the branch I wanted to point to)
$ git submodule update
$ cd parent_dir
$ git submodule 

  +de19ea0a71cb6082fe9311694a27e8f0cc2f972a directory_path/fsmlite (v0.7.1)

这是我想要的具体提交号


推荐阅读