Git 显示 <commit> 并获取文件子集的差异

Git show <commit> and get diff for a file subset

我正在寻找使用 git show <commit> 命令获取提交差异的解决方案。

通常我做:

$> git show 12f00d

正如预期的那样,我得到了在给定提交中修改的所有文件的所有差异。

现在我在重构后有一个大提交(许多文件 changed/moved),我只需要知道在这个提交中递归地更改了所有 xml 文件中的内容。 我有很多 .java、.xsl、.properties 文件,只有少数 .xml 文件。

我尝试了以下命令但没有成功:

$> git show 12f00d -L 0,0:*.xml 
    > incorrect syntax

$> git show 12f00d *.xml 
    > no result

$> git show 12f00d **/*.xml 
    > Return the root pom.xml but not recursively

$> git show 12f00d **/**.xml 
    > Return the root pom.xml but not recursively

$> git show 12f00d -- *.xml 
    > no result

$> git show 12f00d -- **/*.xml 
    > Return the root pom.xml but not recursively

$> git show 12f00d -- **/**.xml 
    > Return the root pom.xml but not recursively

我用命令 git diff <commit> 尝试了相同的选项。

我在 Linux CentOS(bash 终端)下使用 Git 版本 1.8.4。

你知道这样的过滤器是否可以用 git(也许是另一个命令)

试试这个: git show 12f00d '*.xml'