git diff --stat 解释

发布于 2024-11-28 19:55:51 字数 328 浏览 1 评论 0原文

Git 的 pull 输出 已经在这里得到了很好的解释。尽管如此,我仍然不确定文本图到底与什么相关。

例如:

git diff --stat master HEAD^

输出(截断):

Site/index.php | 118 ++--

虽然修改的行数清楚地显示为 118,但文本图表有点难以解释。

这是否与添加和删除线路的比率有关?

Git's pull output has been explained here fairly well. In spite of this I'm still unsure exactly what the text graph relates to.

For example:

git diff --stat master HEAD^

Outputs (truncated):

Site/index.php | 118 ++--

While the number of lines modified is clearly displayed as 118, the text graph is a little harder to interpret.

Could this relate to the ratio of added and removed lines?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

日暮斜阳 2024-12-05 19:55:51

是的,它是添加和删除的行的比率。

参见:

man diffstat

Yes it's the ratio of added and removed lines.

See also:

man diffstat
懒猫 2024-12-05 19:55:51
git diff --numstat "@{1 day ago}"

参数:

  • diff = 显示差异
  • --numstat = 显示插入和删除的行数
  • @{1 天前} = 句点。

输出

0   1   WebContent/WEB-INF/tags/Grid.tag
38  30  ant/build.xml
  • 列 1(包含 0 38)= 插入
  • 列 2(包含 1 30)= 删除

PS:列用制表符 (\t) 分隔。

git diff --numstat "@{1 day ago}"

Parameters:

  • diff = Show diff
  • --numstat = show the number of lines inserted and removed
  • @{1 day ago} = Period.

Output

0   1   WebContent/WEB-INF/tags/Grid.tag
38  30  ant/build.xml
  • Column 1 (containing 0 38) = inserted
  • Column 2 (containing 1 30) = removed

PS: Columns are separated by tab (\t).

心如荒岛 2024-12-05 19:55:51

正如我在此处回答的那样:

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

118 给出更改的行数,- / + 给出删除/添加的比例。
当更改量可以容纳一行时,每次添加将得到“+”,每次删除将得到“-”;
否则,这是一个近似值,例如

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

CHANGES.txt 上,因为您可以看到没有“-”,并且自 47 '+ ' 是很多,你有一定比例的数量(即 100%)。
make-release.py 上,您会看到 x39 '+' 代表 55 个添加,x16 '< em>-' 代表 22 个删除。
完全按照它们的比例,以及适合输出屏幕的数量。

每行的符号数量是适合行宽的 GCD 倍数。

希望有帮助。

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 118 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文