Git Merge: What do the pluses mean?

后端 未结 4 1295
借酒劲吻你
借酒劲吻你 2021-01-11 10:50

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 ++++++++++         


        
相关标签:
4条回答
  • 2021-01-11 11:22

    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.

    0 讨论(0)
  • 2021-01-11 11:25

    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.

    0 讨论(0)
  • 2021-01-11 11:29

    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.

    0 讨论(0)
  • 2021-01-11 11:32

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

    0 讨论(0)
提交回复
热议问题