问题
Or, how to use git whatchanged command to list commits for specified user? Is there any none-scripting way? (builtin git command)
回答1:
I believe there's no such a way to get a diff only knowing dates.
As of today you can do the following:
git log --since "OCT 4 2011" --until "OCT 11 2011" --pretty=format:"%H"
And then git diff
between first and last revisions. If the revision list is far too long, use the above git log ...
with | head -1
and | tail -1
to get the first and the last revisions.
Note that the above git log will return revisions exactly between given dates, i.e. revisions for OCT 5, OCT 6, ..., OCT 10.
回答2:
This is possible, and with the user / committer criteria:
git log --after="2015-10-14" --before="2015-10-21" --grep="MB[FT][0-9-]*" --author="John\|Mary"
This will match anything
- between those date
- by authors matching the names
John
orMary
- where the commit message includes (e.g. a Jira ticket number in the form of)
MBT
orMBF
plus a number-code that can include a-
char.
回答3:
git log --since "MAY 1 2017" --until "MAY 31 2017" -p --author="Jack" > diffJackMay.patch
来源:https://stackoverflow.com/questions/7926077/how-to-get-diff-for-specified-user-between-two-dates-from-git