2013-04-05 37 views
4

我想知道如何使git的列表中的所有修改过的文件如何让特定路径中的某个特定类型的特定错误的git列出所有已更改的文件?

    某种类型的
  • (例如所有的PHP文件)
  • 一定的缺陷提交下没有。或者仍然未提交
  • ,并在特定的路径

我会奠定了一个例子情况我的问题开始。

说我已经改变了以下文件:

提交的更改

/site/main.php 
/site/main.html 
/site/includes/lib.php 

提交3
提交信息: “错误XYZ:做了一些改变”

/site/main.php 
/site/main.html 
/site/main.js 
/test/test.php 
/test/test.html 

凯明2
提交消息: “错误XYZ:提出了一些更多的变化”

/site/main.php 
/site/main.html 
/site/includes/include.php 

提交1
提交消息: “错误ABC:注意,这是另一个bug”

/site/login.php 

说我还在研究bug xyz。现在我需要一个所有php文件的列表,这些文件在这个bug的站点目录中已经被修改。所以我需要下面的列表作为输出:

/site/main.php 
/site/includes/lib.php 
/site/includes/include.php 

什么命令可以做到这一点?

回答

7

这接近于:

git log --grep=xyz -- '*.php' 

--grep参数被施加到提交信息。文件参数上的单引号可确保git进行扩展。

测试:

[email protected](328)$ git log --oneline 
f687708 bar x, y, not a 
dfb4b96 foo d, e, f 
df18118 foo a, b, c 
[email protected](329)$ git log --oneline --grep=a 
f687708 bar x, y, not a 
df18118 foo a, b, c 
[email protected](330)$ git log --oneline --grep=a -- 'a.*' 
df18118 foo a, b, c 

文件扩展可能需要的东西来处理子目录。排序:

git log --oneline --grep=a -- '*/a.*' 'a.*' 
相关问题