【问题标题】:Git is it possible to show the current tag of a submodule?Git是否可以显示子模块的当前标签?
【发布时间】:2020-10-12 12:02:32
【问题描述】:

是否可以显示当前子模块的标签而不必在其目录中?

我想做类似的事情

git describe --tags <submodule_dir> 

并返回特定的标签。

【问题讨论】:

    标签: git tags git-submodules


    【解决方案1】:

    您可以使用git submodule foreach (doc here) 从每个子模块中运行命令:

    # something like the following should work :
    git submodule foreach 'echo $name : `git describe --tags`'
    

    对于诸如git describe 之类的命令(它仅从.git/ 目录中提取其信息,而不是从工作树中),您可以将git 目录作为参数传递给git 命令:

    # the .git directory for a submodule can be found under .git/modules/module_name :
    git --git-dir=.git/modules/module_name describe --tags
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-01
      • 2020-10-05
      • 1970-01-01
      • 2011-11-21
      • 1970-01-01
      • 2013-01-14
      • 1970-01-01
      相关资源
      最近更新 更多