5

For example:

  • How can I display when HEAD@{2} was created?
  • Given a commit's SHA1, how can I display the date it was pulled into the current repo, rather than (or in addition to) its commit date?

I thought there would be a git reflog option for this, but as far as I can see, there is not.

wchlm
  • 365
  • 1
  • 11

1 Answers1

5

git reflog --date=iso

will show the reflog with dates.

This is mentioned indirectly in the manpage:

The subcommand "show" (which is also the default, in the absence of any subcommands) will take all the normal log options[...]

For more controle over the reflog formatting, you can also use git log -g, which also shows the reflog.

sleske
  • 81,358
  • 34
  • 189
  • 227
  • Not. --date=iso reformats the commit date. As I stated in the question, I want to display the date that the local repo was modified by the commit. This is very often later. For instance (typical scenario), someone makes changes and updates his/her own repo, and later you pull from it. – wchlm Oct 31 '13 at 04:22
  • @wchlm: Yes, it does :-). --date=iso reformats the commit date *for git log*; for git-reflog, it formats the reflog date. Just test it: check out a different branch, and look at the output of "git reflog --date=iso". You'll see it shows the checkout, and the date is when you did the checkout, not the commit date. – sleske Oct 31 '13 at 09:16
  • @wchlm: However, if `git reflog --date=iso` does not show the information you are looking for, please edit your question to explain what exactly you want to see (with an example). Maybe you are looking for something else entirely? – sleske Oct 31 '13 at 09:17
  • On your second comment, my question says exactly what I want to know: the date when *local* updates were made to the git repo. Not the date when commits were made, at possibly some remote repo. In addition, the body states: "how can I display the date it was pulled into the current repo, rather than (or in addition to) its commit date". So this is as clear as could be, it seems to me. On your previous comment, ("Yes, it does"), I did check, though in a different way. Let me do another check though and get back on this point. – wchlm Oct 31 '13 at 18:07
  • 1
    OK, Thanks for your comments. I see where I went wrong. In fact, "--date=iso" does two things when applied to "git log -g": it alters the format of the Date: field, and this is the only thing I noticed earlier. The Date field shows the commit date. "--date=iso" also alters the Reflog: field to show the date I am looking for: the date the repository received the commit. I did not notice this earlier, and was looking for the date in the Date field to change. – wchlm Oct 31 '13 at 21:05