在git-describe中提交计数计算 [英] commit count calculation in git-describe

查看:108
本文介绍了在git-describe中提交计数计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释为什么git描述使用count作为git log tag..input显示的提交数量[from git-describe(1)]?



从概念上讲,我曾经认为git-describe使用了自从标签作为单调增加柜台。但是,它似乎实际上使用了从'input'到达的提交数减去'tag'可达到的提交数。为什么会这样?



在这种特殊情况下,我创建了一个发布标签(1.0.0),然后创建了一个补丁版本(1.0.1)在分支上(1.0)。我合并了[参见 http://www.kernel.org/pub/software /scm/git/docs/gitworkflows.html ]分支更改为主。然而,当我用git来描述对master的更新近的提交时,count与git log tag..input的输出相匹配。我希望它匹配git log --ancestry-path tag..input。



谢谢。

解决方案 是一种以有意义的方式沟通 HEAD 的方法。这是对我在历史上的哪个位置?这个问题的简单回答。或者这是什么版本的代码?。

因此,当您运行该命令时,它会从当前所在的位置开始,无论这是 master 的提示,其他一些标签,或者只是一个随机提交。从这个起点开始,它通过提交向后计数,直到找到一个标记。从那里它将打印标签,提交数量,然后是短提交数量。


Can anyone explain why git describe uses a count as "the number of commits which would be shown by git log tag..input" [from git-describe(1)]?

Conceptually I had thought git-describe used the number of commits since the tag as a monotonically increasing counter. However, it seems it actually uses the number of commits reachable from 'input' minus those reachable by 'tag'. Why is that?

In this particular case, I've created a release tag ("1.0.0") and then a patch release ("1.0.1") on a branch ("1.0"). I've merged up [see http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html] the branch changes to master. Yet when I git-describe a more recent commit on master the count matches the output of git log tag..input. I expected it to match git log --ancestry-path tag..input.

Thanks.

解决方案

git describe is a way to communicate the HEAD in a meaningful way. It is a simple answer to the question "Where am I in the history?" or "What version of the code is this?"

So, when you run the command it starts where you currently are, whether that is the tip of master, some other tag, or just a random commit. From this starting point it counts backwards through commits until it finds a tag. From there it will print the tag, number of commits counted, then the short commit number.

这篇关于在git-describe中提交计数计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆