Apparently this:
git log --all --after="<date> 00:00" --before="<date> 23:59" --author="<author>"
filters commits based on the committer date. How can I make it show commits for a specified author date range ?
2 Answers. Show activity on this post. git log --author=<pattern> will show the commit log filtered for a particular author. ( --committer can be used for committer if the distinction is necessary).
Maybe I'm missing something, but wouldn't this be enough?
git log --pretty=format:"%ad - %an: %s" --after="2016-01-31" --until="2017-03-10" --author="John Doe"
See also here
You can't—at least, not in Git alone. (Reminder to others visiting this question: it's not about viewing the author date, it's about selecting commits by the author date, a la --since
/--after
and --until
/--before
. These selectors use the committer date, not the author date. Consider as an extreme example a commit made "now", so that its committer date is in the 2000s, but backdated in the author-date field to some day in the year 1999. If your selection range is "any time near the turn of the century" you'll de-select this commit, since its committer date is "now", more than a decade beyond 1999.)
I consider this a small bug in Git: you should be able to request that it use the author date field anywhere you can request that it use the committer date field. This is easy with log formatting, since we have %ad
and %cd
and the like, but impossible with commit selection. The closest we have is that git rev-list
can sort by author-date (within general topo-sorting).
A global switch in git rev-list
, like --use-author-date
, would work as a simple patch, and would not be too hard to add to Git, but I think it would be better to have --min-author-age
and --max-author-age
or similar, and a "sort by author date" flag (independent of the general --topo-order
flag, so that setting both flags has the same effect as --author-date-order
).
As a workaround, you can list all potentially-interesting commits (with git rev-list
or equivalent, such as git log
: use whatever specifier makes commits potentially interesting, except for date filters: in this case that's just --all
) and extract all of their author-date fields (with git log --format=%at
or whatever), then do your own pruning of the list of commit IDs, then re-submit the remaining commit IDs to git log --no-walk
. But this is painful at best. See Tim Beigeleisen's answer using awk for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With