How does git log –since count?

In case it helps someone else who lands here like I did, after a bit of researching I found out that using ISO8601 format also works:

git log --since="2014-02-12T16:36:00-07:00"

This will give you precision down to the second. Note: you can also use:

git log --after="2014-02-12T16:36:00-07:00"
git log --before="2014-02-12T16:36:00-07:00"
git log --since="1 month ago"
git log --since="2 weeks 3 days 2 hours 30 minutes 59 seconds ago"

etc.

Of course, this doesn’t “explain why it works so strange.” However, it certainly solved the problem for me.


EDIT:

After a bit more research, I found out “why it works so strangely”:
It turns out that when you don’t specify a date format, git log defaults to either the author’s timezone or commit dates, meaning for consistent behavior, it’s useful to explicitly declare your date format with something like:

git log --date=local

Lastly, when you don’t specify a time, it defaults to your local time when you ran the command.

Long story short, being specific should solve the problem:

git log --date=local --after="2014-02-12T16:36:00-07:00"

Also, you can set the default date format permanently with the following command:

git config log.date local

you can use any one of these values: (relative|local|default|iso|rfc|short|raw)

Leave a Comment