Search code examples
gitgit-describegit-hash

what does the hash from `git describe` refer to?


$ git describe --tags --long
test-1-g3c31c73
           \_ ???

The g3c31c73 doesn't seem to point to anything... The doc says it's the abbreviated object name of the most recent commit, but it's not the HEAD commit hash, and find .git/objects -type f | grep g3c31c73 finds nothing.


Solution

  • The "g" isn't a part of the commit.

    Try looking for a commit 3c31c73 using git show 3c31c73.

    From the git-describe doc:

    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.