开发者

Git Merge: What do the pluses mean?

I ran "git merge" from开发者_运维知识库 Terminal on Mac OS X to merge a branch into my master and receive output that looks like:

 spec/models/user_spec.rb    57 ++++++++++++++++++++

What does the "57 ++++++++++++++++++++" mean? Is that how many times I inserted/modified that file? What are all the plusses for?


57 lines changed. The pluses are graphical indications of the number of lines changed, kind of like a bar chart. They make more sense when you have changed several files, as they give a quick way to see the relative amount of lines changed per file.

I've found that if you only make a few changes, each plus corresponds to one line. As you make more, it scales them back.

It also shows minuses for line deletions.

If you made 28 (57/2) line changes in another file, you would see a string of pluses half as long next to it.


As I answered here:

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

The 57 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.

The amount of signs per line the a GCD multiple that fits the line width.

Hope that helps.


In complement to other answers: this is the diffstat syntax, not just a Git thing. Git shows the diffstat after a merge, or when you ask for it like git diff --stat which produces roughly the same output as git diff | diffstat.


Basically, yes - there were 57 changes to that file and they were all additions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜