I want to be able to see all of the commits I made today using git log
. I came up with git log --after="yesterday"
However, that seems a little awkward to me, is there a simpler command to achieve the same effect?
6 Answers
Edit: Since this is the accepted answer I can't delete it, so I'm posting here @Simon's answer:
git log --since="6am"
And of course you can adjust the time to whatever is "morning" enough for you :)

- 69,862
- 18
- 95
- 117
-
10This does not seem to work on git 1.5.6.5, FWIW. I know, old version and all, but I figure this might help someone. `git log --after="yesterday"` seems to come closest to correct, but it ends up including things that occurred yesterday along with things that occurred *after* yesterday. – Aug 11 '11 at 16:20
-
3For me: `git log --since="yesterday"` works well. Looks nice with `--pretty="oneline"` too... (git version 1.7.10) – Nick Jan 22 '13 at 17:05
-
--since and --after are synonyms, so the answer is suggesting the same thing that is in the question. This will give give the last 24 hours of commits (hence @agentbanks217 problem with seeing commits from yesterday). I have give a different answer below. – cogg Jun 22 '13 at 18:38
-
2Also, times like `"06:00"` work, for those that don't like AM/PM – Hubro May 15 '17 at 08:03
-
1I had imagined this would work until 5:59am the following day. However, it only lists commits on the same day (i.e., it stops working at midnight) – binaryfunt Aug 14 '17 at 23:39
Maybe the best is to use
git log --since="6am"
You can adjust the time to your convenience ;)

- 31,675
- 9
- 80
- 92
-
1
-
I voted for this one over the other as it appears to be several days earlier. – astrochun Apr 02 '21 at 22:19
To get commits from all of today ...
git log --since=midnight

- 8,310
- 4
- 56
- 50
-
This command will show commits from today midnight 12AM to 11:59PM right ? – Bhumit 070 Dec 14 '22 at 05:16
You can create alias to shorten this command
git config --global alias.today 'log --since=7am'
and then execute:
git today

- 15,573
- 9
- 52
- 68
There are already several useful correct answers (e.g. git log --since="6am"
) but it is odd that Git's special dates are missing from the documentation (at least googling "yesterday" "noon" site:git-scm.com returns no results).
There are ways to find out what's available, for example the answers to Specification for syntax of git dates are particularly useful. In one Ryan O'Hara points out that
it seems to accept all formats that it can output, as described in the documentation for the --date option:
--date=(relative|local|default|iso|rfc|short|raw)
Only takes effect for dates shown in human-readable format, such as when using
--pretty
.log.date
config variable sets a default value for log command’s--date
option.
--date=relative
shows dates relative to the current time, e.g. "2 hours ago".
--date=local
shows timestamps in user’s local timezone.
--date=iso
(or--date=iso8601
) shows timestamps in ISO 8601 format.
--date=rfc
(or--date=rfc2822
) shows timestamps in RFC 2822 format, often found in E-mail messages.
--date=short
shows only date but not time, inYYYY-MM-DD
format.
--date=raw
shows the date in the internal raw git format%s %z
format.
--date=default
shows timestamps in the original timezone (either committer’s or author’s).
My favourite answer there is from me_and who directs us to the git date.c class. Scan down that and you find this code (at the time of writing it is on line 925):
static const struct special {
const char *name;
void (*fn)(struct tm *, struct tm *, int *);
} special[] = {
{ "yesterday", date_yesterday },
{ "noon", date_noon },
{ "midnight", date_midnight },
{ "tea", date_tea },
{ "PM", date_pm },
{ "AM", date_am },
{ "never", date_never },
{ "now", date_now },
{ NULL }
};
I'm definitely using git log --before=tea
, though looking at the date_tea
function I don't think they've read Rupert Brooke:
static void date_tea(struct tm *tm, struct tm *now, int *num)
{
date_time(tm, now, 17);
}