git:列出一天(或一周/月...)添加/修改的所有文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8016645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git: list all files added/modified on a day (or week/month...)
提问by thias
Given a period of time (e.g. a day, a week, a month), is it possible to list all files that were modified or added in this time?
给定一段时间(例如一天、一周、一个月),是否可以列出这段时间内修改或添加的所有文件?
采纳答案by inger
I'd use diff to yield the file list directly, e.g:
我会使用 diff 直接生成文件列表,例如:
git diff --name-only "@{3 days ago}" "@{2 days ago}"
changelog.txt
newfile.txt
In case you're curious which file got modified or added, use --name-status instead:
如果您想知道修改或添加了哪个文件,请改用 --name-status:
git diff --name-status "@{3 days ago}" "@{2 days ago}"
M changelog.txt
A newfile.txt
回答by manojlds
Maybe this:
也许这个:
git log --since="1 day ago" --name-only --pretty=format: | sort | uniq
Include --until
if you want for a day, week etc.
包括--until
你是否想要一天、一周等。
回答by anshuman
I use this to get a clean list:
我用它来获得一个干净的列表:
git whatchanged --since '04/14/2013' --until '05/22/2014' --oneline --name-only --pretty=format: | sort | uniq >> changedlist.txt
回答by Dan Cruz
Git whatchanged
should give you what you want, listing what files were modified.
Gitwhatchanged
应该给你你想要的,列出修改了哪些文件。
Here's an example using Git source:
这是一个使用 Git 源代码的示例:
$ git --version
git version 1.7.8.rc0.35.gee6df
$ git whatchanged --since '10/27/2011' --until '10/30/2011' --oneline
55e7c0a (squash) test for previous
:100755 100755 dbf623b... 53905a2... M t/t8006-blame-textconv.sh
2564aa4 blame.c: Properly initialize strbuf after calling, textconv_object()
:100644 100644 173f286... e39d986... M builtin/blame.c
e8e1c29 Update draft release notes to 1.7.8
:100644 100644 3045245... ddb8d37... M Documentation/RelNotes/1.7.8.txt
8debf69 clone: Quote user supplied path in a single quote pair
:100644 100644 488f48e... efe8b6c... M builtin/clone.c
回答by yasar
Try:
尝试:
git log --since="2 days ago" --until="1 days ago"
git log --since="2 days ago" --until="1 days ago"
If you omit --until
you will get logs for last two days. You can also spesify weeks, months etc. You can also use git diff with --since and --until parameters. Work a little bit on output formatting and you are done.
如果您省略,--until
您将获得最近两天的日志。您还可以指定周、月等。您还可以使用带有 --since 和 --until 参数的 git diff。稍微处理一下输出格式就大功告成了。
回答by metal4people
Here is one more without empty lines:
这里还有一个没有空行:
git log --after="2015-11-05T16:36:00-02:00" --before="2015-11-15T16:36:00-02:00" --pretty=format:"" --name-only | sed '/^\s*$/d' | sort | uniq -u
回答by Tamilselvan K
Git BASH Command
Git BASH 命令
git whatchanged --since '11/24/2017' --until '11/29/2017' --oneline --name-only --pretty=format: | sort | uniq >> changedlist.txt