When I use a <path>
argument with git log --stat
to limit the log to
commits modifying <path>
, git lists <path>
as the only modified file when
displaying the selected commits. I would instead like to see all modified
paths listed for each selected commit.
例如:
$ echo test > a.txt
$ echo test > b.txt
$ git add a.txt b.txt
$ git commit -m test
[...]
2 files changed, 2 insertions(+), 0 deletions(-)
[...]
$ git log -n1 --stat
[...]
a.txt | 1 +
b.txt | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
$ git log -n1 --stat -- a.txt
[...]
a.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Note that the second git log
, with the path argument a.txt
, says
"1 files changed", when in fact "2 files changed". I would like git
to tell me that both a.txt
and b.txt
changed, even though I
selected the commit based on the path a.txt
.
更新: @ jacknagel 回答了我的问题, 但结果发现他的解决方案在我的真正使用案例中行不通。 在我的实际使用案例中, 我寻找所有对文件进行修改的人, 包括重命名, 在两个相关项目出现分歧的情况下。 我需要找出一个项目的修改意味着另一个项目的相应修改( 我需要做) 。 不幸的是, 当我同时尝试使用 < code>- full- diff < /code > 和 < code >- follow 时, 抱怨 < code > - full- diff 和 < code >- follown 。
所以,在我的真实情况下,我试图运行:
git log --stat --follow -- a.txt
在这种情况下,一个行之有效的解决办法是:
git log --format= %H --follow -- a.txt | xargs git show --stat -C