What does ^{} mean in git?

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.

Leave a Comment