2

考虑以下摘录git log --oneline --decorate --graph

*   552485a (HEAD -> master, origin/master) Finish v0.8.4
|\
| * c198066 (tag: v0.8.4) some commit message
* |   343af72 Finish v0.8.3
|\ \
| |/
| * 0267e30 (tag: v0.8.3) some commit message
* |   8f0ff57 some commit message
|\ \
| |/
...

(注意:标签 v0.8.4 来自分支“开发”的提交)

当我跑步时,我git describe怎么会得到这个:

v0.8.4-16-g552485a

也就是说,自标签 v0.8.4 以来,git 计算了 16 次提交。我希望它会回来v0.8.4-1-g552485a

更具体地说(使用 --debug 选项时):

suche zur Beschreibung von HEAD
beendete Suche bei b53e85f9c8ee785c0ce50f727819b267107554fd
 annotated         16 v0.8.4
 annotated         17 v0.8.3
 annotated         18 v0.8.2
 annotated         22 v0.8
 annotated         49 v0.7
 annotated         60 v0.6
 annotated         85 v0.5
103 Commits durchlaufen
v0.8.4-16-g552485a

有趣的是,如果我切换到我的开发分支:

0992f78 (HEAD -> develop, origin/develop) Some commit message.
c198066 (tag: v0.8.4) Minor change.
0267e30 (tag: v0.8.3) Minor changes.

git describe按预期返回:v0.8.4-1-g0992f78

背景:我正在使用 SmartGit 及其 Git-Flow 功能。

这是相关提交的图形视图(红色:master,蓝色:develop):

在此处输入图像描述

4

1 回答 1

1

该数字不仅使用自标签以来的提交计算。在合并的情况下,其他分支的提交也包括在内。

git-describe的文档

额外提交的数量是“git log v1.0.4..HEAD”将显示的提交数量。

于 2015-08-06T12:10:36.983 回答