52

Possible Duplicate:
Git Merge: What does this mean?
Git diff --stat explanation

Sorry for the stupid question, but i can't find a clear answer anywhere.

When you merge two branches in git, you get an output like that :

 some_file.txt  |  564 ++++++++++++++--

I undestand that + and - mean addition and deletion, but :

  • what does the number of signs represent ? when you have few changes, each sign seem to represent a line, but when you have more signs, i can't get the logic of the representation

  • is it some sort of percentage of changes ? My guess is that the number of signs represents a relative amount of changes - but relative to what ? current file ? the whole merge ?

  • how is it calculated ? Is there any official source about this ? The most accurate answer i had on this by now is "this representation is not very precise"... i'm just curious

Community
  • 1
  • 1
m_x
  • 12,357
  • 7
  • 46
  • 60
  • 2
    http://stackoverflow.com/questions/4965322/git-merge-what-does-this-mean – Geert Dec 07 '12 at 10:38
  • 2
    @GeertJaminon I would **not** close the question since it does explicitly focus on the mixture of `++++` and `--` which is not answered on the suggested duplicate. – eckes Dec 07 '12 at 10:49
  • 1
    @eckes I don't see this question containing anything about the mixture of `++++` and `--` though – Geert Dec 07 '12 at 11:05
  • apologies, but the point of my question is "what does the number of signs mean". It seems that when little change has occurred, you have one sign per added or deleted line, but when you have a lot of change i don't get the logic behind the representation. the other question does NOT answer this. – m_x Dec 07 '12 at 12:29
  • edited my question for clarity – m_x Dec 07 '12 at 12:34
  • mmm yes that's more like it. "the +- indicator is not very precise"... ok, but isn't it any _official_ doc on this ? i'm just curious – m_x Dec 07 '12 at 12:45
  • 2
    I've tried searching. The most official answer I got is it's a "histogram" of the deletions/additions/modifications. – mgarciaisaia Dec 07 '12 at 13:05
  • to people who closed this, i do not agree. i was looking for an accurate explanation on _how it is calculated_ , which is not the point of the other questions. See comments on the answer. – m_x Dec 08 '12 at 11:28

1 Answers1

37

It supposed to reflect the number of changes (in lines) to each file listed.
Plus signs for additions, minuses for deletions.

EDIT:
the 564 gives the amount of changed lines, and the - / + gives you the proportion of deletions/additions.
When the amount of changes can fit a line you'll get '+' per addition, '-' per deletion;
Otherwise, this is an approximation, e.g.

CHANGES.txt     |   47 +++++++++++++++++++++++++++++++++
make-release.py |   77 +++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 102 insertions(+), 22 deletions(-)

On CHANGES.txt since you can see that there are no '-', and since 47 '+' are a lot you have a proportionate amount of them (i.e. 100%).
On make-release.py you'll see x39 '+' standing for 55 additions and x16 '-' standing for 22 deletions.
Exactly as their proportion, and just the amount to fit output screen.

Hope that helps.

Woodchuck
  • 3,869
  • 2
  • 39
  • 70
Ofir Farchy
  • 7,657
  • 7
  • 38
  • 58
  • 3
    ok, this is what i assumed, but how is calculated the length of the line ? on my 564 changes, i just get a bunch of +-, and you get a lot more on your 77. My guess is that the line length is relative to proportion of changes in regard to the whole commit, but i'd like to know for sure – m_x Dec 07 '12 at 15:02
  • 2
    That sounds reasonable, I cannot tell you for sure. Empirically (tested on quite a few repositories) this **is** proportionate to the other files' change size. To my understanding this is some kind of `GCD` multiple. – Ofir Farchy Dec 07 '12 at 20:29