2015-10-06 67 views
0

我要尋找一個解決方案,使提交使用git show <commit>命令的區別。的Git顯示<commit>並獲得差異的文件集

通常我做:

$> git show 12f00d 

和預期的一樣,我得到的所有差異在給定修改的所有文件提交。

現在我有一個很大的提交(許多文件更改/移動)重構後,我只需要知道什麼在此提交中遞歸地更改所有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>相同的選項。

我使用GIT中版本1.8.4 Linux下的CentOS(bash的端子)。

你知道,如果這樣的過濾器,可以用git(也許是另一個命令)

+0

你是從版本庫的根目錄或子目錄調用'git的show'? –

+0

我有一個multimodule(maven)項目,我從父項目執行命令。 –

回答

1

試試這個: git show 12f00d '*.xml'

+0

您的解決方案無法在我的機器上運行(Centos 6.5),但是如果我現在使用:'git show 12f00d - '* .xml''它按預期工作。 –

+0

這將是更好的解釋爲什麼我們必須把單引號,因爲我沒有在文檔中找到任何與此相關的任何內容。 –

+0

這裏的解釋:http://stackoverflow.com/questions/13321458/meaning-of-git-checkout-double-dashes?answertab=votes#tab-top – grimsock