git: list all files added/modified on a day (or we

2019-02-01 05:01发布

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?

标签: git git-log
6条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-01 05:23

Maybe this:

  git log --since="1 day ago" --name-only --pretty=format: | sort | uniq

Include --until if you want for a day, week etc.

查看更多
Animai°情兽
3楼-- · 2019-02-01 05:24

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
查看更多
等我变得足够好
4楼-- · 2019-02-01 05:25

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
查看更多
Bombasti
5楼-- · 2019-02-01 05:31

Try:

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.

查看更多
淡お忘
6楼-- · 2019-02-01 05:43

Git whatchanged should give you what you want, listing what files were modified.

Here's an example using Git source:

$ 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
查看更多
放荡不羁爱自由
7楼-- · 2019-02-01 05:44

I'd use diff to yield the file list directly, e.g:

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:

git diff --name-status "@{3 days ago}" "@{2 days ago}"

M       changelog.txt
A       newfile.txt
查看更多
登录 后发表回答