如何在git中显示标签的完整历史记录? [英] How to show full history of tags in git?

查看:163
本文介绍了如何在git中显示标签的完整历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只需简单地删除它们,然后重新标记,显然可以将git中的标签从一次提交移到另一次提交.

Tags in git can apparently be moved from one commit to another by simply deleting them and then re-tagging.

例如:

git tag -m "Version 1.0" v1.0 abcd123
git push --tags
git tag -d v1.0
git tag -m "Corrected version 1.0" v1.0 1234abc
git push --tags

如何查看特定标签的全部历史记录? (换句话说,任何时候创建/删除具有该名称的标记,以及每个标记所指向的内容)

How do I see the entire history of a particular tag? (In other words, any time a tag with that name was created/deleted, and what commits each one pointed to)

如何查看所有标签的全部历史记录?

How do I see the entire history of all tags?

推荐答案

它们也可以用力移动:

git tag -f ...

然后强行推入.

如何查看特定标签的全部历史记录? (换句话说,任何时候创建/删除名称为name的标记,以及每个标记所指向的内容)

How do I see the entire history of a particular tag? (In other words, any time a tag with than name was created/deleted, and what commits each one pointed to)

通常不能.

如果标签被强制移动并强制推入,并且保留了标签的引用日志,则可以从标签的引用日志中检索以前的值,直到这些引用日志条目到期为止.但是,删除引用(任何引用)会删除引用日志.

If a tag is force-moved and force-pushed and you keep reflogs for tags, you can retrieve previous values from the tag's reflog, until those reflog entries expire. Deleting a reference (any reference), however, deletes the reflog.

带注释的标记使用存储库中的对象(除了引用本身之外).删除引用将仅 删除对带注释的标签对象的外部标签名称引用.只要没有删除基础对象本身,就可以通过ID访问它.但是,作为未引用的对象,它必须遵循通常的垃圾收集规则.仅当某些附加引用(通常是另一个带注释的标签的另一个标签名称)使原始带注释的标签对象可访问时,才能保证将其保留在存储库中.

Annotated tags use objects within the repository (in addition to the reference itself). Deleting the reference deletes only the external tag-name reference to the annotated-tag object. As long as the underlying object itself has not been removed, you can access it by ID. As an unreferenced object, though, it is subject to the usual garbage-collection rules. Only if some additional reference (usually another tag-name for another annotated tag) keeps the original annotated-tag object reachable is it guaranteed to remain in the repository.

(没有根本的原因,树对象不能指向标签对象,因此有可能有一个提交对象指向一棵树,该树保留了旧的带注释的标签.但是,Git并不是这样做的,并且没有构建此类内容的工具,并且git fsck可能会认为它们是错误的,因此,这更多是一种理论上的练习:从理论上讲,可以通过特殊的方式保存并保留旧标签"和标签历史记录"如果至少编写了一个Git管道命令和几个脚本,则提交可能会通过新的引用名称空间(例如refs/tagarchive/)进行,当然,这完全是推测,除非有人编写这些. 有用.)

(There's no fundamental reason a tree object could not point to tag objects, so it would be possible to have a commit object that pointed to a tree that keeps old annotated tags around. But Git is not built to do this, and has no tools for constructing such things, and it's possible that git fsck would consider them erroneous. So this is more a theoretical exercise: it would theoretically be possible to save, and persist, "old tags" and "tag history" through special commits, probably pointed-to through a new reference name space such as refs/tagarchive/, if at least one Git plumbing command and several scripts were written. Of course this is all pure speculation until someone writes these. It's not clear how they would be useful, either.)

这篇关于如何在git中显示标签的完整历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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