git - 如何列出自某个日期以来没有更改过的所有文件? [英] git - How to list all files that have not been changed since a certain date?

查看:218
本文介绍了git - 如何列出自某个日期以来没有更改过的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从我的存储库中获取自某个日期以来尚未触及的文件列表。



我试图使用 git log --before =X months ago--name-only 然后将该列表与 git log --after =X months ago--name-only 进行比较,但我不确定是否有更简单的方法?



那还是有办法让HEAD提交每个文件的日期并过滤列表吗?我不确定最好的方法是什么。

解决方案



  git diff --name-only --stat @ {2.weeks.ago}>> changed.txt&& git ls-files>> all.txt&& comm -23 all.txt changed.txt>> 
$ b $ p

> 1:抓取所有已更改的文件名称,并创建一个名为changed.txt的文本文件
2:抓取repo中的所有文件名并创建一个名为all.txt的文本文件
3:使用comm命令来抑制两个文件之间的共同行,并输出到一个名为unchanged.txt的文件。



希望这有助于,



感谢朋友的这个解决方案(Adam Morse)。

I'm trying to get a list of files in my repository that have not been touched since a certain date.

I was trying to make use of git log --before="X months ago" --name-only and then comparing that list against git log --after="X months ago" --name-only but I'm not sure if there's an easier way?

That or is there a way to get the HEAD commit's date of each file and filter the list? I am unsure of what the best approach is for this.

解决方案

There is probably a better way to do this but this should work:

git diff --name-only --stat @{2.weeks.ago} >> changed.txt && git ls-files >> all.txt && comm -23 all.txt changed.txt >> unchanged.txt

What it does,

1: Grabs all file names that have been changed and creates a text file called changed.txt 2: Grabs all file names in the repo and creates a text file called all.txt 3: Uses the comm command to suppress common lines between the two files and outputs to a file called unchanged.txt

Hope this helps,

Thanks to this solution from a friend (Adam Morse).

这篇关于git - 如何列出自某个日期以来没有更改过的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆