Is there a way to cause git-reflog to show a date alongside each entry?
Per the man page, you can use git log
options, e.g.,
git reflog --pretty=short
git reflog --date=iso
You can use a custom format:
git reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)'
In the above format, %h
is the commit hash, %cr
is the relative committer date, %gs
is the reflog subject, and, %s
is the commit subject. Look at the git-log docs for other possible placeholders. For instance, using %ci
instead of %cr
will show absolute commit dates.
You can save this in your ~/.gitconfig using a custom pretty
format and refer to it via an alias:
[alias]
rl = reflog --pretty=reflog
[pretty]
reflog = %C(auto)%h %<|(20)%gd %C(blue)%cr%C(reset) %gs (%s)
You can use the --walk-reflogs
variant of git log
:
git log -g
This is rather verbose by default, and prints the date among other things. You can format it with the standard --pretty=
flag.
You can also use the reflog command directly with the --pretty=
flag to format the output.
git reflog --pretty='%cd %h %gd %gs'
In the format above, %cd
shows the commit date to the left of the normal reflog output.
Tell git
in what format, either counted reflog
entries or timed reflog
entries, i.e.
git reflog @{now}
git reflog @{0}