Git 全局标签——显然很糟糕,但为什么呢? [英] Git global tags--- evidently bad, but why?

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

问题描述

在他的 2005 年发送给 Linux 内核邮件列表的电子邮件中,Linus Torvalds 非常强调 git 中的标签应该是私有的,并且在从其他人那里获取时不会自动包含在内:

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

和:

认为获取别人的树是错误的,错误的,错误的表示你应该获取他的标签.

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

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

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?

推荐答案

这里的关键词是不自动包含".您可以推送和拉取标签,您只需在推/拉命令中指定它.试试 git push --tags.

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天全站免登陆