我应该在什么情况下将-a标志添加到git标签命令中? [英] In what circumstances should I add the -a flag to the git tag command?

查看:107
本文介绍了我应该在什么情况下将-a标志添加到git标签命令中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这两种命令之间的技术差异(没有使用-a会创建一个轻量级标记,本质上它是一个永远不会移动的分支,使用-a在Git的对象数据库中创建一个完整对象,其中包括提交者的名称,电子邮件等)。

I am aware of the technical differences between the two types of command (usage without -a creates a lightweight tag which is essentially a branch that never moves, usage with -a creates a full object in Git's object database which includes the committer's name, email, etc).

问题是:我应该在我的项目中使用哪一个(例如,在Github上指示发布版本)?如果一个人比另一个人更受欢迎,为什么还有其他选择?每个版本的用例是什么?

The question is: which one should I use in my projects (to indicate release versions on Github, for example)? And if one is hugely preferred over another, why does the other option exist? What are the use cases for each version?

推荐答案

我会说,对于已发布的工作,您应该始终使用带注释的标记。额外的信息永远不会对你造成伤害。

I'd say that with published work, you should just always use annotated tags. That extra information is never going to harm you.

轻量级标签让我感到更懒惰。也许是一个临时标签(只要确保不会意外推送它;实际上你可以只使用一个分支),或者可能是一个个人回购站,这些回收站没有太多的额外信息。我的猜测是,很多小型项目也是这样做的。他们只是不关心这些信息。可能只有一个集成商,没有人关心验证签名标签,他们只是发布版本的简单标记。 (我仍然认为你应该更喜欢带注释的标签,以防万一!)

Lightweight tags strike me as being more for when you're being lazy. Maybe a temporary tag (just make sure you don't accidentally push it; really you could just use a branch), or maybe a personal repo where there's not much use for the extra information. My guess is that a lot of smaller projects do this too; they're just not really concerned with the information. Probably there's only one integrator, no one's concerned with verifying signed tags, and they're just simple markers of release versions. (I still think you should prefer annotated tags, just in case!)

另一种想法是:轻量级标签就像写了一个非常糟糕的提交消息。你真的不应该这样做,但有时候人们会这么做,通常在没有人注意的时候。

Another way of thinking of it: lightweight tags are kind of like writing a really bad commit message. You really shouldn't do it, but sometimes people do, usually when no one's watching.

这篇关于我应该在什么情况下将-a标志添加到git标签命令中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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