简体   繁体   中英

how to interpret git describe output

I was playing with git describe:

git branch
  branch1
* master

git tag tag1 HEAD~2

git tag tag2 HEAD

git describe --all HEAD~1
tags/tag1-1-gb772e8b

git rev-parse tag1
1ae346a3b91f5dbe4110ae143ce86825d79b82f3

What does it mean by "1-gb772e8b" in "tag1-1-gb772e8b" ?

tag1-1-gb772e8b
^    ^  ^ 
|    |  |
|    |  git hash of the commit  
|    |
|   number of commits after the tag 
|
|
Most recent tag

This is all in reference to the commit you are giving to git describe. In your case it is HEAD~1, so

  • HEAD~1 has commit hash b772e8b
  • HEAD~1 is 1 commit after the most recent tag
  • the most recent tag older than HEAD~1 is tag1

See the documentation for more in-depth information, the output depends on whether there are any tags, and what state the repository is in and arguments you provide to git describe

There's also a g in the hash, gb772e8b . The docs describe it as

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM