Git:diff / merge输出中+/-符号的数量是什么意思? [英] Git: what does the number of +/- signs in diff / merge output mean?

查看:187
本文介绍了Git:diff / merge输出中+/-符号的数量是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

Git Merge:这是什么意思?

Git diff --stat explain


对不起,这个愚蠢的问题,但我无法在任何地方找到明确的答案。



当你在git中合并两个分支时,你会得到如下输出:

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

我不确定 + - 表示添加和删除,但是:


  • 标志数量代表什么?
    当您有少许变化时,每个符号似乎代表一条线,但是当你有更多的迹象时,我无法得到表示的逻辑。


  • 是某种比例的变化吗?我的猜测是,符号的数量代表了相对的变化量 - 但相对于什么?当前文件?整个合并?


  • 它是如何计算的?有没有官方我现在最准确的答案是这种表示方法不是很精确......我只是好奇而已

  • 它应该反映列出的每个文件的更改次数(行)。

    加上符号,删除次数减少。

    编辑
    564 给出了改变的行数量, em> - / + 会为您提供删除/添加的比例。

    当更改的数量可以符合某条线时,您将获得' + '每增加一个,' - '每删除;

    否则,这是一个近似值,例如

      CHANGES.txt | 47 +++++++++++++++++++++++++++++++++ 
    make-release.py | 77 +++++++++++++++++++++++++++++++++++++++ ---------- ------
    2个文件已更改,102个插入(+),22个删除( - )

    CHANGES.txt 上,因为您可以看到没有' - ',并且自47' + em>'很多,你有相当数量的(即100%)。

    make-release.py 你会看到 x39 ' + '代表55个添加项, x16 ' - '代表22个删除项。

    完全按照它们的比例,只是适合输出屏幕的金额。



    希望有帮助。


    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

    解决方案

    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.

    这篇关于Git:diff / merge输出中+/-符号的数量是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆