Git显示最近2天内发生更改的文件

我怎样才能得到所有在过去两天内被更改的文件? 我知道

git log --name-status --since="2 days ago" 

但这会显示我的ID,date和提交消息。 我所需要的是被更改的文件名列表。

这可能与Git?

 git log --pretty=format: --name-only --since="2 days ago" 

如果某些文件在多个提交中复制,则可以使用pipe道进行过滤

 git log --pretty=format: --name-only --since="2 days ago" | sort | uniq 
 git diff --stat @{2.days.ago} 

简短有效

使用–raw选项来git日志:

 $ git log --raw --since=2.days 

请参阅–gif日志帮助页面的–diff-filter部分,了解–raw格式中显示的标志的说明。 他们解释了每个提交中的文件会发生什么情况:

  --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (ie regular file, symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected. 

你可以做一个与2天前最接近的版本的差异:

git diff $(git log -1 --before="2 days ago" --format=%H).. --stat

--stat给你一个变化的总结。 添加--name-only来排除任何元信息,只有一个文件名列表。

希望这可以帮助。

 git log --pretty="format:" --since="2 days ago" --name-only