Git:diff/merge 输出中 +/- 符号的数量是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13761376/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:52:39  来源:igfitidea点击:

Git: what does the number of +/- signs in diff / merge output mean?

gitdiff

提问by m_x

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

可能的重复:
Git Merge:这是什么意思?
Git diff --stat 解释

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 :

当你在 git 中合并两个分支时,你会得到这样的输出:

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

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

我不明白 +-意思是添加和删除,但是:

  • what does the number of signsrepresent ?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 officialsource about this ? The most accurate answer i had on this by now is "this representation is not very precise"... i'm just curious

  • 什么迹象的数量代表什么?当你的变化很少时,每个符号似乎代表一条线,但是当你有更多的符号时,我无法理解表示的逻辑

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

  • 它是如何计算的?是否有任何官方消息来源?到目前为止,我对此的最准确答案是“这种表示不是很精确”……我只是很好奇

采纳答案by Ofir Farchy

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

它应该反映列出的每个文件的更改数量(以行为单位)。
加号表示添加,减号表示删除。

EDIT:
the 564gives 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.

编辑:
564给出了改变线的量,-/ +为您提供了删除/添加的比例。
当更改量可以容纳一行时,每次添加都会得到 ' +',每次删除都会得到' -';
否则,这是一个近似值,例如

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

On CHANGES.txtsince 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.pyyou'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.

CHANGES.txt因为你可以看到有没有“ -”,并自47“ +”很多,你对他们有相当的数量(即100%)。
在上,make-release.py您会看到x39' +' 代表 55 次添加,而x16' -' 代表 22 次删除。
完全按照它们的比例,只是适合输出屏幕的数量。

Hope that helps.

希望有帮助。