Git: 列出所有最近最少更改的文件

Git: list all least recently changed files

我有一个很大的 git 存储库,我想找到按日期排序的长时间未修改的文件列表,我尝试了命令:

git log --pretty=format: --summary --before="<date>" 

它给了我在 date 之前修改过的文件的列表,但我想知道所有文件按最后修改日期降序排列(最旧的文件将在最上面)。此外,该列表应该只有存储库中当前存在的文件,我不关心已经删除的文件。

任何人都可以建议正确的命令吗?

不要认为有 git 命令可以做到这一点,但请尝试 tree 命令和 sort。 它看起来有点丑,但我相信它非常接近你想要的

tree -ifFCD --timefmt '%Y%m%d %H%M%S' | sort -k1 -k2

-D print the date of the last modification time or if -c is used, the last status change time for the file listed.

基于link,@Fred 在评论中发表,你可以试试这个:

while read file; do echo $(git log --pretty=format:%ai -n 1 --date=raw -- $file) $file; done < <(git ls-tree -r --name-only HEAD) | sort -r

对我有用。