如何git标记所有子模块? [英] How to git tag all submodules?

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

问题描述

我想标记项目的所有子模块.我尝试用以下方法做到这一点:

I would like to tag all of the submodules of my project. I tried to do that with:

git submodule foreach git tag tagName

...但是似乎什么也没做就返回没有错误.

... but it appears to just return with no errors, having done nothing.

这是我尝试的结果:

有人可以告诉我如何正确标记所有子模块吗?

Can someone tell me how to properly tag all submodules?

注意:这与此问题非常相似,但针对该问题的答案建议依赖于超级项目中的子模块refs.但是,我实际上希望在子模块的存储库中添加一个标签.

Note: this a very similar question to this post, but the answer for that one suggested to rely on the submodule refs in the super-project. I, however, would actually like a tag in the submodule's repo.

推荐答案

首先,确保您的子模块文件夹包含内容:

First, make sure your submodule folder have a content:

git submodule update --init --recursive

然后,只需:

 git submodule foreach git tag -l

对于每个子模块,您应该看到tagName.
意味着您先前的命令确实确实标记了那些子模块.

You should see, for each submdule, tagName.
Meaning your previous command did indeed tag those submodules.

我建议制作一个带注释的标记不过,不是轻量级:

I would recommend to make an annotated tag though, not a lightweight one:

git submodule foreach git tag -m "tagName" tagName

这意味着您可以从每个子模块中推送该标签.

That means you can push that tag from each submodule.

如果仅在父存储库级别标记,则将包括子模块gitlink,即其SHA1.在您的情况下就足够了.

If you just tag at the parent repo level, that will include the submodule gitlink, that is their SHA1. That could be enough in your case.

这篇关于如何git标记所有子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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