Git的全球标签---显然不好,但为什么? [英] Git global tags--- evidently bad, but why?

查看:191
本文介绍了Git的全球标签---显然不好,但为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在他的 2005年电邮给Linux Kernel邮件列表中,Linus Torvalds非常强调git中的标签应该是私有的,并且在从其他人获取时不会自动包含:
$ b blockquote>

拉正常头不能必须 更新标签。标签不是与树相关的
,而且它们 让它们成为全球性而不是私人性的,它将从根本上使
不会被分发

和:


错误,错误,错误认为提取某人elses树
意味着您应该提取他的标签。

我不是一名核心黑客。我使用git的原因之一是能够从不同位置编辑我自己的代码。标签看起来像是描述不同版本以供将来参考的自然方式,例如,什么可行,什么不可行,存在什么怪癖。因此,对于我来说,让标签在提取过程中持续存在似乎很有帮助。有人能解释这种范例的危险吗?

为什么私人标签如此重要?什么是替代方案?每次我想标记特定版本的代码时,我是否应该简单地创建一个单独的分支?

解决方案

关键词包含not 。您可以推拉标签,只需在推/拉命令中指定它即可。尝试 git push --tags



(实际上,标签会自动被拉取,但推送必须明确。)


In his 2005 email to the Linux Kernel mailing list, Linus Torvalds is very emphatic that tags in git should be private and not be automatically included when fetching from others:

Pulling a regular head cannot and must not update tags. Tags are not associated with the tree, and they cannot and must not be so, exactly because that would make them global instead of private, and it would fundamentally make them not be distributed

and:

It is wrong, wrong, wrong to think that fetching somebody elses tree means that you should fetch his tags.

I am not a kernal hacker. One of the reasons I use git is to be able to edit my own code from different locations. Tags seem like a natural way to describe different versions for future reference, e.g. what works, what doesn't, what quirks exist. Thus to me it would seem helpful to have tags persist across fetches. Can someone explain what the peril of this paradigm is?

Why is having private tags so important? And what is the alternative? Should I simply make a separate branch every time I may want to flag a particular version of the code?

解决方案

The key word there is "not automatically included." You can push and pull tags, you just have to specify it in your push/pull commands. Try git push --tags.

(Actually, tags are automatically pulled these days, but pushes must be explicit.)

这篇关于Git的全球标签---显然不好,但为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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