I have a test repository with 18 commits. git log | grep Date: git log | grep Date: returns the following:
Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200 Date: Thu Sep 19 09:53:10 2013 +0200 Date: Wed Sep 18 17:04:41 2013 +0200 Date: Wed Sep 18 17:03:36 2013 +0200 Date: Sat Sep 14 14:42:10 2013 +0200 Date: Wed Sep 11 10:37:25 2013 +0200 Date: Fri Aug 30 13:59:43 2013 +0200 Date: Fri Aug 30 13:56:35 2013 +0200 Date: Fri Aug 30 11:30:17 2013 +0200 Date: Thu Aug 29 13:44:28 2013 +0200 Date: Thu Aug 29 13:34:32 2013 +0200 Date: Wed Aug 28 14:44:03 2013 +0200 Date: Wed Aug 28 14:32:44 2013 +0200 Date: Tue Aug 27 16:18:53 2013 +0200 Date: Tue Aug 27 16:16:29 2013 +0200 Date: Tue Aug 27 15:46:04 2013 +0200
I want to get a log from all the commits that occurred today (09/20/2013), so I tried
git log --since=20-09-2013 | grep Date:
I do not understand anything. So I searched a bit here for SO and found this question. The comments say that
it seems such that without any time it defaults to the value of the last second of the day.
OK, no problem. Try git log --since=19-09-2013 . It returns
Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200 Date: Thu Sep 19 09:53:10 2013 +0200
Wait, that seems weird, doesn't it? If he should use the last second of the specified date, why should he display the commit that occurred at 09:53:10 on that date? Should git only display commits that occurred after 09/19/2013?
But wait, it gets even weirder! I tried to add time, resulting in
git log --since=20-09-201309:00:00 Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200
This trio ... wait a minute ... All commits occurred before 09:00:00 . Why does git display them? In fact, as far as I know, I also made a syntax error! Try to try:
git log --since=20-09-201312:08:00 | grep Date: Date: Fri Sep 20 08:04:13 2013 +0200 Date: Fri Sep 20 08:03:28 2013 +0200 Date: Fri Sep 20 08:02:05 2013 +0200
Still working ...
git log --since=20-09-201312:09:00 | grep Date: <nothing>
Hmm, what happened there? It seems that git uses only the last two: -segmented numbers. But why does git display commits that occurred after 20.09.2013 08:00 , if it seems like I'm actually looking for a commit after 20.09.201312 08:00 ? That makes no sense to me.
Can someone explain this mess to me? This does not mean that I do not have a solution to solve my problem, but I want to understand what is happening here ...