The git-reflog command doesn't by default show a date alongside each entry, which strikes me as a strange oversight; I think this would be very helpful.
Are there any command-line options, or other tweaks, which can be employed to cause it to show when each reflog entry was added? The manpage isn't forthcoming...
As the man page writes you can use the options for
git log
, saygit reflog --pretty=short
or any other as you liketry
You can use the
--walk-reflogs
variant ofgit log
: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.In the format above,
%cd
shows the commit date to the left of the normal reflog output.You have to use a custom format:
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:Tell
git
in what format, either countedreflog
entries or timedreflog
entries, i.e.Note git 2.10 (Q3 2016) improves the documentation about date with
git reflog
.See commit 642833d, commit 1a2a1e8 (27 Jul 2016), and commit d38c7b2, commit 522259d, commit 83c9f95, commit 2b68222 (22 Jul 2016) by Jeff King (
peff
).Helped-by: Jeff King (
peff
).(Merged by Junio C Hamano --
gitster
-- in commit 0d32799, 08 Aug 2016)The
rev-list
options is updated:It includes: - an update about
--date=raw
:And a new option:
--date=unix