关于两个标签之间所有文件的Git统计信息 [英] Git statistics on all files, between two tags

查看:59
本文介绍了关于两个标签之间所有文件的Git统计信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是偶尔的git用户,现在我遇到了一个我无法理解的问题:

I am just an occasional git user, and now I have a problem that is beyond my knowledge:

假设有一个git存储库,没有分支,只有标签.对于给定的两个标签.我需要获取存储库中所有文件的列表,每个文件后接两个数字:两个标签之间添加到特定文件的行数,以及两个标签之间从同一文件删除的行数.

Let's say there is a git repository, no branches, just tags. For given two tags. I need to get the list of all files in the reposotory, each followed by two numbers: number of lines added to the particular file between two tags, and number of lines deleted from the same file between the two tags.

我在网上搜索,但仅找到解决与贡献者相关的类似问题的解决方案,而不是文件.

I searched online, but I found only solutions for similar problem that deals with contributor, not files.

推荐答案

您可以使用 --numstat 选项以显示两个标记之间的每个修改文件的以十进制表示的添加和删除的行数".

You can use git diff with the --numstat option to show "number of added and deleted lines in decimal notation" for each modified file between the two tags.

git diff tag1 tag2 --numstat

git文档:

--numstat选项提供了diffstat(1)信息,但是它是专门设计的 以便更轻松地使用机器. --numstat输出中的一个条目看起来 像这样:

The --numstat option gives the diffstat(1) information but is designed for easier machine consumption. An entry in --numstat output looks like this:

1 2 README
3 1 arch/{i386 => x86}/Makefile

也就是说,从左到右:

  1. 添加的行数;
  2. 标签;
  3. 已删除的行数;
  4. 标签;
  5. 路径名(可能带有重命名/复制信息);
  6. 换行符.
  1. the number of added lines;
  2. a tab;
  3. the number of deleted lines;
  4. a tab;
  5. pathname (possibly with rename/copy information);
  6. a newline.

这篇关于关于两个标签之间所有文件的Git统计信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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