“git describe” ignores a tag

后端 未结 4 650
夕颜
夕颜 2020-12-23 19:11

In the following lines:

$ git tag -n1
v1.8        Tagged the day before yesterday
v1.9        Tagged yesterday
v2.0        Tagged today
$ git describe
v1.9-5         


        
4条回答
  •  梦毁少年i
    2020-12-23 19:29

    The issue is git tag shows all tags in all branches while git describe only uses tags on commits which are available in the current branch.

    Here is an example (the reason why I came here actually):

     $ git tag | tail -n3
    v0.4.0
    v0.4.1
    v0.4.2
    

    It shows the latest tag available is v0.4.2, but this is my output of git describe:

     $ git describe --tags
    v0.4.0-2-acd334c
    

    I'm on develop branch. When I dig into the log, I see indeed the most recent tags are not available on the current branch:

     $ git log --oneline --decorate=short | grep 'tag\:' | head -n3
    acd334c (tag: v0.4.0) Merge pull request #1061
    988fe5e (tag: v0.3.6) Merge pull request #859
    5f97274 (tag: v0.3.5) Merge pull request #646
    

    So in my case, the developers decided to create a new release branch exclusively for tagging releases which results that the develop branch is not up to date with the tags anymore.

    Hope that helps and thanks @eis for the idea with checking the logs.

提交回复
热议问题