我在 git ls-remote 命令的末尾偶然发现了两个奇怪的字符,我想知道这是什么意思?
0e4c39557ccb6789173c refs/tags/2011-11-04
966f8df553f18c486820 refs/tags/2011-11-04^{}
你碰巧知道这个 ^{} 是什么意思吗?另外,为什么这个 git 标签看起来是重复的?
最佳答案
^{}
符号在 gitrevisions
中进行了解释手册:
<rev>^{}, e.g. v0.99.8^{}
A suffix ^ followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non-tag object is found.
在这种情况下 - refs/tags/2011-11-04
是指向标签对象 0e4c39557ccb6789173c
的标签。通过执行 refs/tags/2011-11-04^{}
,我们可以将标签取消引用到最终的非标签对象,在本例中是 - 966f8df553f18c486820
(a犯罪)。请注意,^{}
在应用于非标记对象时是一个 noop。
git show-ref
命令可用于查看标签以及最终取消引用的非标签对象:
$ git show-ref --tags
3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c
423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{}
$ git show-ref --tags --dereference
3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c
6ddc0964034342519a87fe013781abf31c6db6ad refs/tags/v0.99.9c^{}
055e4ae3ae6eb344cbabf2a5256a49ea66040131 refs/tags/v1.0rc4
423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{}
来自git show-ref
手册:
-d
--dereference
Dereference tags into object IDs as well. They will be shown with "^{}" appended.
关于git - ^{} 在 git 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12938972/