Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git branch/tag name with ^{}

Tags:

git

Running the command git ls-remote lists the following entries:

e6c1ddea6ee8eefa9e96e349dd4fad4a48c16448    refs/tags/1.1
1a3b5ae3a50ca2f24e5cd917cbf51d371f1dd01e    refs/tags/1.1^{}
81901877c5add523cd4a4bb8f51ad3bbbacbd686    refs/tags/1.2
4681b1ae6ec71301019da13d1790c2f808c2c553    refs/tags/1.2^{}

What does the ^{} mean in the output?

like image 391
axiopisty Avatar asked Oct 21 '13 19:10

axiopisty


People also ask

Can a branch name have '/' in git?

Git imposes the following rules on how references are named: They can include slash / for hierarchical (directory) grouping, but no slash-separated component can begin with a dot . or end with the sequence . lock . They must contain at least one / .

How do you tag a branch in git?

In order to create a Git tag for the last commit of your current checked out branch, use the “git tag” command with the tag name and specify “HEAD” as the commit to create the tag from. Similarly, if you want your tag to be annotated, you can still use the “-a” and “-m” options to annotate your tag.

Can git branch names have slashes?

Other than some exceptions — such as not starting or ending a name with a slash, or having consecutive slashes in the name — Git has very few restrictions on what characters may be used in branch and tag names.

Can git tag and branch have the same name?

You should never name a tag and a branch the same name! It makes sense in a case like this to use naming conventions on the tags to keep from colliding on the branch names. Versus when we releasing code from the master branch. You can find the common parent in git using merge-base to do a Tag on code from the past.


1 Answers

They are not part of the name, but rather an indicator to git rev-parse that it should dereference a tag (and, with any luck, find a commit, although in theory the tag could point to another tag, or even a tree or blob; but if it points to another tag, the ^{} keeps on peeling the onion layers until it hits a non-tag).

git ls-remote (or really, the remote itself) uses this syntax to send you the commit-ID. (I'm not quite sure what happens if the tag ultimately points to a tree or blob.)

like image 136
torek Avatar answered Oct 11 '22 18:10

torek