How to get diff for specified user between two dates from git?

ε祈祈猫儿з 提交于 2019-12-09 07:39:37

问题


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 or Mary
  • where the commit message includes (e.g. a Jira ticket number in the form of) MBT or MBF 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!