Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ^{} mean in git?

Tags:

git

I stumbled upon two odd characters at the end of a git ls-remote command and I wonder what this means?

0e4c39557ccb6789173c  refs/tags/2011-11-04 966f8df553f18c486820  refs/tags/2011-11-04^{} 

Do you happen to know what this ^{} means? Also, why does this git tag seems duplicated?

like image 691
vanz Avatar asked Oct 17 '12 16:10

vanz


People also ask

What does mean{} in git tag?

In this case - refs/tags/2011-11-04 is the tag that points to the tag object 0e4c39557ccb6789173c . By doing refs/tags/2011-11-04^{} we can dereference the tag to the final non-tag object, which in this case is - 966f8df553f18c486820 (a commit).

What is refs head Git?

git/refs/ . In Git, a head is a ref that points to the tip (latest commit) of a branch. You can view your repository's heads in the path . git/refs/heads/ . In this path you will find one file for each branch, and the content in each file will be the commit ID of the tip (most recent commit) of that branch.

Where are git refs stored?

Refs are stored as a normal file text in . git/refs directory.


1 Answers

The ^{} notation is explained in the gitrevisions manual:

<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.

In this case - refs/tags/2011-11-04 is the tag that points to the tag object 0e4c39557ccb6789173c. By doing refs/tags/2011-11-04^{} we can dereference the tag to the final non-tag object, which in this case is - 966f8df553f18c486820 (a commit). Note that ^{} is a noop when applied to non-tag objects.

The git show-ref command can be use to see tags as well as the final dereferenced non-tag objects:

$ 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^{} 

From the git show-ref manual:

-d  --dereference  

Dereference tags into object IDs as well. They will be shown with "^{}" appended.

like image 63
manojlds Avatar answered Sep 18 '22 15:09

manojlds