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.
The number of + and - is not necessarily the number of changes but more of the ration between these. Otherwise, for big changes you'll see endless + or -.
In your specific example, there is a place for ~26 + for file SingleSpooler.java that contains 31 changes, so the ratio is approximately 5:6.
Therefore, for file .classpath which has 6 lines added you see only 5 + (6 * 5/6), for PrintSpooler.java you get 22 + (27 * 5/6), etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With