How can I configure git log
to show commit date
instead of author date
?
-
27@Colleen Each commit has two dates associated - AuthorDate and CommitDate (`git show --pretty=fuller HEAD` to se an example). For local development, these are usually the same, but for patches added via e-mail or other mechanisms, they can differ, where the AuthorDate is the date the patch was generated, and the CommitDate being when it was actually applied to the repository. – twalberg Jan 09 '13 at 18:55
-
Kind of related: [How to make `git log` show only the commit date, nothing else](https://stackoverflow.com/q/71384830/4561887) – Gabriel Staples Mar 07 '22 at 17:18
4 Answers
There are several options to pretty print the date. Probably the easiest is to just use one of the pre-baked --pretty
formats, like git log --pretty=fuller
- this will show both dates. If you want to see only one date, but make it the commit date, you can use git log --format=<some stuff>
. All the allowable codes for defining the format are documented in git help log
. The commit date is one of %cd
, %cD
, %cr
, %ct
or %ci
, depending on what format you prefer it in.
If it's something you want to do often, put it in an alias or write an auxiliary script to save on typing.

- 30,436
- 41
- 178
- 315

- 59,951
- 11
- 89
- 84
You can use --pretty=format
and use %cr
for commit date relative.
For example:
$ git log --graph --pretty=format:'%C(auto)%h%d (%cr) %cn <%ce> %s'
You can define an alias in git to make this easier to use. I have the following in my .gitconfig
:
[alias]
# see `git help log` for detailed help.
# %h: abbreviated commit hash
# %d: ref names, like the --decorate option of git-log(1)
# %cn: commiter name
# %ce: committer email
# %cr: committer date, relative
# %ci: committer date, ISO 8601-like format
# %an: author name
# %ae: author email
# %ar: author date, relative
# %ai: author date, ISO 8601-like format
# %s: subject
# my awesome git log replacement
lol = log --graph --pretty=format:\"%C(auto)%h%d%Creset %C(cyan)(%cr)%Creset %C(green)%cn <%ce>%Creset %s\"
# same as above, but ISO date
lold = log --graph --pretty=format:\"%C(auto)%h%d%Creset %C(cyan)(%ci)%Creset %C(green)%cn <%ce>%Creset %s\"
# using build-in standards
lol2 = log --oneline --graph --decorate
# shows branches and their last commits
lol3 = log --all --graph --decorate --oneline --simplify-by-decoration
On Linux or similar systems, you can use single-quotes '
instead of double-quotes "
:
[alias]
lol = log --graph --pretty=format:'%C(auto)%h%d%Creset %C(cyan)(%cr)%Creset %C(green)%cn <%ce>%Creset %s'
With this, simply run git lol
, or the other variants to see the pretty output.
Here's the output of git lol --simplify-by-decoration
:
- It looks good. :)
lol
is easier to type thanlog
, and sounds better too.- Also gives you access to the regular
git log
if you ever need it.
- Also gives you access to the regular
- Your eyes can scan contents quickly by the different colors.
- Names and e-mails are very useful for large projects/org with many contributors.
- Using default coloring for hash/ref as it is already pretty good.
Here's the output of git lold
with dates in ISO format. Useful to see the exact date/time a commit is made, with the bonus of being able to see the contributor's timezone easily.
Edit 2020-06: Added screenshots. Updated to use %C(auto)
(auto/default coloring) for %h
(commit hash) and %d
(ref names). Added %cn
(commiter name) in addition to email.

- 2,423
- 1
- 21
- 12
-
1I get a parsing error: `git log --graph --pretty=format:\"%C(yellow)%h%Creset%C(cyan)%C(bold)%d%Creset %C(cyan)(%cr)%Creset %C(green)%ce%Creset %s\"` bash: syntax error near unexpected token `(' – Frak Mar 31 '16 at 00:22
-
2@frakman1 — you need to un-escape the "s for the above line to run in the terminal – stites Apr 29 '16 at 20:04
-
3Corrected line: git log --graph --pretty=format:"%C(yellow)%h%Creset%C(cyan)%C(bold)%d%Creset %C(cyan)(%cr)%Creset %C(green)%ce%Creset %s" – RedSands Nov 07 '16 at 14:39
I prefer this format, doesn't include author name and includes actual date for commit.
git log --graph --pretty=format:"%C(yellow)%h%x09%Creset%C(cyan)%C(bold)%ad%Creset %C(green)%Creset %s" --date=short

- 453
- 4
- 7
-
'actual date' that the _author_ created the first version of that commit content. If it had since been rebased or otherwise re-committed, the final commit date for what you see there is found with the '%c' format stem. The '--short-date' option is synonymous with the 'iso' date format output of %ai and %ci – Jul 21 '21 at 13:01
Might be useful to someone. I was looking for date and time stamps with the author name.
git log --graph --pretty=format:"%C(yellow)%h%x09%Creset%C(cyan)%C(bold)%ad%Creset %C(yellow)%cn%Creset %C(green)%Creset %s" --date=default

- 10,465
- 4
- 53
- 64
-
Since the question is about showing commit-date, you will need to change `%ad%` with `%cd%` to view commit-date. `ad` is for author date. – rupinderjeet Nov 23 '22 at 06:09