24

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.

Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67
  • 1
    possible duplicate of [How to configure 'git log' to show 'commit date'](http://stackoverflow.com/questions/14243380/how-to-configure-git-log-to-show-commit-date) – Tim Biegeleisen Jun 08 '15 at 08:15
  • 1
    Yes, i can parse the output of the cmd in the question and filter commits based on the commit date. Is there a better way to do it though ? – Kaushik Lingerkar Jun 08 '15 at 10:59
  • Looking through the code my initial take is "you can't", but it looks like a great opportunity to submit a patch to git :) – larsks Jun 18 '15 at 23:31
  • 3
    I cannot reproduce this with git 1.9.1. `--since`/`--until` use the commit timestamp here: http://pastebin.com/yYDVyqxc – Phillip Jun 19 '15 at 06:26
  • I dont think you can do what you ask for - since git is a DVCS. Each commit is into the "master" copy of a repository ie each repo is a clone. Thus, the commit is in the same universal (ie relatively local) time ie local to that machine. Not sure if that confuses you even more. – Vijay Raghavan Aravamudhan Jun 19 '15 at 17:36

3 Answers3

22

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
Jyoti Prakash
  • 3,921
  • 3
  • 21
  • 24
2

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.

Michał Kalinowski
  • 16,925
  • 5
  • 35
  • 48
0

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

Mauddev
  • 361
  • 2
  • 14