开发者

Git global tags--- evidently bad, but why?

开发者 https://www.devze.com 2022-12-12 16:27 出处:网络
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:

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 fu开发者_JS百科ndamentally 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.)


I don't know, but tags are actually fetched these days, and that has been the default for a pretty long time.

The wording in the parts you're quoting seems confusing to me when looking at it with today's git terminology, so I'd dare to claim that Linus's statement is outdated.

0

精彩评论

暂无评论...
验证码 换一张
取 消