Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git describe --tags --long adds character to hash? [duplicate]

Tags:

git

git rev-parse --short HEAD outputs:

6aa3158a

git describe --tags --long outputs:

2.3.4-rck1-0-g6aa3158a

I see that the latter command adds a g to the commit hash. Why is this?

like image 228
basickarl Avatar asked Oct 09 '17 13:10

basickarl


2 Answers

From man git-describe:

The "g" prefix stands for "git" and is used to allow describing the version of a software depending on the SCM the software is managed with. This is useful in an environment where people may use different SCMs.

like image 180
Andrew Marshall Avatar answered Oct 22 '22 02:10

Andrew Marshall


That is the documented behavior of --longaccording to git-describe(1):

   --long
       Always output the long format (the tag, the number of commits and
       the abbreviated commit name) even when it matches a tag. This is
       useful when you want to see parts of the commit object name in
       "describe" output, even when the commit in question happens to be a
       tagged version. Instead of just emitting the tag name, it will
       describe such a commit as v1.2-0-gdeadbee (0th commit since tag
       v1.2 that points at object deadbee....).

And later on in the same document is an explanation for why it adds the g prefix to the hash:

The "g" prefix stands for "git" and is used to allow describing the version of a software depending on the SCM the software is managed with. This is useful in an environment where people may use different SCMs.

like image 36
larsks Avatar answered Oct 22 '22 02:10

larsks