问题描述
我试图了解 git log --stat
命令的输出。
第一个输出:
提交4c90aee323acc337a37040e02a0a3644f4155738
日期:星期五5月1日22:46:11 2015 -0400
在SingletonPattern示例中提交一些更改示例
自述文件| 2 ++
SingletonPattern / src / PrintSpooler.java | 7 ++++++ -
SingletonPattern / src / SingleSpooler.java | 8 +++++ ---
3个文件已更改,13个插入(+),4个删除( - )
以下代码片段中的示例:
SingletonPattern / src / PrintSpooler.java | 7 ++++++ -
这意味着总共有7行改变(6+, )。到目前为止这么好。
现在下一个输出:
commit f6e96c6df122b72ac9f70b841aa8938df1f6741b
日期:Sun Apr 26 02:08:15 2015 -0400
第一次提交消息
SingletonPattern / .classpath | 6 +++++
SingletonPattern / .project | 17 ++++++++++++++
SingletonPattern / bin / PrintSpooler.class | Bin 0 - > 772字节
SingletonPattern / bin / SingleSpooler.class | Bin 0 - > 895字节
SingletonPattern / bin / SingletonException.class | Bin 0 - > 428字节
SingletonPattern / src / PrintSpooler.java | 27 ++++++++++++++++++++++
SingletonPattern / src / SingleSpooler.java | 31 ++++++++++++++++++++++++++
SingletonPattern / src / SingletonException.java | 20 +++++++++++++++++
更改了8个文件,101个插入(+)
我无法解释下面的代码片段:
SingletonPattern / src / SingletonException.java | 20 +++++++++++++++++
显然,after 20有17+。是不是会有20+呢?
同样在这里:
SingletonPattern / .classpath | 6 +++++
不符合实际数量的加号(或减号)。这是因为没有足够空间的原因。
使用时的重要性 - stat
是查看哪些文件被修改了发生在他们身上的事情。你关心每增加一行是否有一个加号?可能不会。你想看到的是一个文件与另一个文件相比有多大改变。而这正是显示的内容。这些文件旁边的加号是相对于彼此的:
| 6 +++++ 5/6 = 0.83
| 17 ++++++++++++++ 14/17 = 0.82
| 27 ++++++++++++++++++++++ 22/27 = 0.81
| 31 ++++++++++++++++++++++++++ 26/31 = 0.84
| 20 +++++++++++++++++ 17/20 = 0.85
每个实际文件更改的插件数量的比率大致相同,因此当您看到具有某些数量的插件的文件,并且另一个文件的插件数量是插件数量的两倍时,则知道该文件有两次你可以尝试使用 - stat-graph-width = n
选项来改变宽度。的统计输出,因此您可以查看条形图在同一个日志条目中以不同大小缩放。
I am trying to understand the output of git log --stat
command.
First output:
commit 4c90aee323acc337a37040e02a0a3644f4155738
Date: Fri May 1 22:46:11 2015 -0400
Submitting some changes in SingletonPattern example
README | 2 ++
SingletonPattern/src/PrintSpooler.java | 7 ++++++-
SingletonPattern/src/SingleSpooler.java | 8 +++++---
3 files changed, 13 insertions(+), 4 deletions(-)
For an example in the snippet below:
SingletonPattern/src/PrintSpooler.java | 7 ++++++-
This means 7 lines changed in total (6+, 1-). So far so good.
Now the next output:
commit f6e96c6df122b72ac9f70b841aa8938df1f6741b
Date: Sun Apr 26 02:08:15 2015 -0400
First commit message
SingletonPattern/.classpath | 6 +++++
SingletonPattern/.project | 17 ++++++++++++++
SingletonPattern/bin/PrintSpooler.class | Bin 0 -> 772 bytes
SingletonPattern/bin/SingleSpooler.class | Bin 0 -> 895 bytes
SingletonPattern/bin/SingletonException.class | Bin 0 -> 428 bytes
SingletonPattern/src/PrintSpooler.java | 27 ++++++++++++++++++++++
SingletonPattern/src/SingleSpooler.java | 31 ++++++++++++++++++++++++++
SingletonPattern/src/SingletonException.java | 20 +++++++++++++++++
8 files changed, 101 insertions(+)
I could not explain the following snippet:
SingletonPattern/src/SingletonException.java | 20 +++++++++++++++++
Clearly, after 20 there are 17 "+". Would not there be 20+ instead?
Same goes here:
SingletonPattern/.classpath | 6 +++++
All those numbers don’t match up with the actual count of pluses (or minuses). This is done for the simple reason that there isn’t enough space.
What’s important to you when using --stat
is to see which files were modified what happened to them. Do you care whether there is a single plus for every added line? Probably not. What you want to see instead is how much one file was changed compared to another. And that’s exactly what is being shown. The pluses next to the files are relative to each other:
| 6 +++++ 5 / 6 = 0.83
| 17 ++++++++++++++ 14 / 17 = 0.82
| 27 ++++++++++++++++++++++ 22 / 27 = 0.81
| 31 ++++++++++++++++++++++++++ 26 / 31 = 0.84
| 20 +++++++++++++++++ 17 / 20 = 0.85
The ratio of "number of pluses" per "actual file change" is approximately the same, so when you see a file with some number of pluses, and another file has twice as many pluses, then you know that that file has twice as many additions.
You can try the --stat-graph-width=n
option to change the width of the stat output so you can see how the bars scale at different sizes for the same log entry.
这篇关于了解git log --stat输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!