Kaushik Lingerkar
Kaushik Lingerkar

Reputation: 449

get commits since a particular date in git based on commit date

To get commits after a particular date. I can do this:

git log <ref> --since=<date> --pretty=format:%ci

This seems to list commits based on author date. How do I get commits after a particular date based on commit time ? I can parse the output of above cmd to get what I desire, however I was wondering if there is a better way to do this.

Upvotes: 26

Views: 11661

Answers (3)

Mauddev
Mauddev

Reputation: 361

If you use %cr instead of %ci, at least you only have time references. But they are relative, like '2 hours ago'.

Upvotes: 0

Jyoti Prakash
Jyoti Prakash

Reputation: 4017

Your query is not that clear to me but I would like to answer with best of my understanding: as we know, with ref: http://git-scm.com/docs/pretty-formats

%ai: author date, ISO 8601-like format
%ci: committer date, ISO 8601-like format

Is this of any help? Using --after and --before to get results in between. Like below uses same date with results between time (10:36AM to 04:50PM of June 22, 2015) with %ci for committer date

git log --after="2015-06-22T10:36:00-07:00" --before="2015-06-22T16:50:00-07:00" --pretty=format:%ci

Upvotes: 24

Michał Kalinowski
Michał Kalinowski

Reputation: 17933

I believe there is no way here to tweak git log here since it is internally implemented to use commit date for before, after, since, until parameters. In general, the default Git's strategy for comparing dates is by commit date.

Upvotes: 2

Related Questions