开发者

what is dereference in the context of git show-ref -d

Here is the man page for git show-ref -d . They also have an example at the bottom. Still I am not able t开发者_JAVA技巧o understand what dereference does?


In Git, a "normal" (annotated, not lightweight) tag is an object unto itself, containing metadata and the SHA1 of the object it tags. Chapter 10.2 Git Internals - Git Objects in the Git community book has an illustration of the object model:

what is dereference in the context of git show-ref -d

Legend: yellow - commit object, blue/green - tree object, white - blob object

So, when you use git show-ref on a normal tag, it will normally give you information about the tag object. With the -d/--dereference option, it will dereference the tag into the object the tag refers to, and provide information about it instead.

And a note on lightweight vs. annotated tags, in case you aren't aware of that: a lightweight tag is created by using git tag <tag name> (i.e. without any of the metadata-providing options like -a, -s, or -u). It's not a tag object at all, just a Git reference pointing straight to the object you've tagged. If you provide one of those options, you're attaching metadata to the tag, so Git creates a tag object to hold that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜