dumbledad dumbledad - 1 year ago 114
Git Question

Can I format git reflog to show when the reference pointed to each commit?

The documentation for git reflog mentions that

git reflog show accepts any of the options accepted by git log.

and so I can do fancy formatting like this:

git reflog --format='%C(yellow)%h%Cred%d%Creset - %Cgreen%an%Creset, %Cblue%ar%Creset : %s' -30

git reflog terminal screen capture

The dates shown are for the commits that the reference pointed to. Is it possible to instead show when the reference was switched to point thus?

Answer Source

git reflog is displaying the content of .git/logs and you have the timestamp in there next to the commit info.

You can use the date format to the display the switch time

git reflog --date=iso

If you wish to see the original value as stored in the log file use the raw format. you can use this if you wish to modify it to a different date format

git reflog --date=raw 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download