# git reflog --date

8 messages from 2014-10-21 to 2014-11-04. Participants: John Tapsell, Junio C Hamano, Phil Hord.
Thread: https://gitlist.dev/t/37772

## John Tapsell, 2014-10-21 08:11

Subject: git reflog --date
Message-ID: <CAHQ6N+oQV8Uesv_eCBZc+hpwR5rDWA22OXR05AJ_zXcf7bfQ7g@mail.gmail.com>
URL: https://gitlist.dev/e/CAHQ6N%2BoQV8Uesv_eCBZc%2BhpwR5rDWA22OXR05AJ_zXcf7bfQ7g%40mail.gmail.com

```
Hi all,

  Could we add a default to "--date" so that:

git reflog --date

just works?  (Currently you need to do:   git reflog --date=iso)  It
should probably obey the default in log.date?

Also, could we add this "--date" option to the man page please?  It's
an extremely useful option to know.  At the moment you have to notice
the comment that "all normal log options" are there, and then try to
work it out from there etc.

Thank you,

John

John

```

## Junio C Hamano, 2014-10-21 17:24

Subject: Re: git reflog --date
Message-ID: <xmqqh9yx1gkt.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqh9yx1gkt.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHQ6N+oQV8Uesv_eCBZc+hpwR5rDWA22OXR05AJ_zXcf7bfQ7g@mail.gmail.com>

```
John Tapsell <johnflux@gmail.com> writes:

> Hi all,
>
>   Could we add a default to "--date" so that:
>
> git reflog --date
>
> just works?  (Currently you need to do:   git reflog --date=iso)  It
> should probably obey the default in log.date?

Hmph.  "--date=<style>" is not the way to choose between timed and
counted output in the first place, though.

In a similar way that "git log -g @{now}" and "git log -g @{0}"
switch between two, "git reflog @{now}" and "git reflog @{0}" have
been the primary way to choose between them.  Only because it is
clear that you want the timed format when you specify any date style
e.g. "git reflog --date=relative", we give timed output without
@{<time>/<number>} but that is just icing on the cake.

That at least is why things are the way they are.  And once you
understand the above, you would understand why "--date=<style>" is
not singled out as a useful option in the documentation, because
that is not a primary way to choose between timed and counted
output, but because it is merely a way to influence how times are
shown once you chose timed output.

Having said all that, I have a few comments:

 - Perhaps use of @{<time>} vs @{<count>} as _the_ way to choose
   between timed and counted output is not documented clearly enough
   to lead to such a misunderstanding?

 - Perhaps use of @{<time>} vs @{<count>} is a less intuitive than
   ideal way to choose between them in the first place?

 - Perhaps adding --date with no date-style specification as another
   way to trigger "You said 'date' so you must mean you want timed
   output" heuristics just like existing "--date=<style>" does may
   let us get away without answering the above two questions,
   sidestepping the issues?

I dunno.

```

## John Tapsell, 2014-10-21 17:31

Subject: Re: git reflog --date
Message-ID: <CAHQ6N+rb6eNC0_uzCAdH-HNb_SmdG4-W9DgmVKjfNpRcKKxk=w@mail.gmail.com>
URL: https://gitlist.dev/e/CAHQ6N%2Brb6eNC0_uzCAdH-HNb_SmdG4-W9DgmVKjfNpRcKKxk%3Dw%40mail.gmail.com
In-Reply-To: <xmqqh9yx1gkt.fsf@gitster.dls.corp.google.com>

```
For me, writing "git reflog @{now}"  is a lot less intuitive than "git
reflog --date"

Currently the top google search for this question is here:

http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry

Which doesn't mention "@{now}"   at all.

My opinion:

1. Add --date   as an option to reflog.  Perhaps using the log.date
format as the default.
2. Document --date in the man page for "git reflog"
3. Document @{now}  in the man page for "git reflog"

Sound good?

John

On 21 October 2014 18:24, Junio C Hamano <gitster@pobox.com> wrote:
> John Tapsell <johnflux@gmail.com> writes:
>
>> Hi all,
>>
>>   Could we add a default to "--date" so that:
>>
>> git reflog --date
>>
>> just works?  (Currently you need to do:   git reflog --date=iso)  It
>> should probably obey the default in log.date?
>
> Hmph.  "--date=<style>" is not the way to choose between timed and
> counted output in the first place, though.
>
> In a similar way that "git log -g @{now}" and "git log -g @{0}"
> switch between two, "git reflog @{now}" and "git reflog @{0}" have
> been the primary way to choose between them.  Only because it is
> clear that you want the timed format when you specify any date style
> e.g. "git reflog --date=relative", we give timed output without
> @{<time>/<number>} but that is just icing on the cake.
>
> That at least is why things are the way they are.  And once you
> understand the above, you would understand why "--date=<style>" is
> not singled out as a useful option in the documentation, because
> that is not a primary way to choose between timed and counted
> output, but because it is merely a way to influence how times are
> shown once you chose timed output.
>
> Having said all that, I have a few comments:
>
>  - Perhaps use of @{<time>} vs @{<count>} as _the_ way to choose
>    between timed and counted output is not documented clearly enough
>    to lead to such a misunderstanding?
>
>  - Perhaps use of @{<time>} vs @{<count>} is a less intuitive than
>    ideal way to choose between them in the first place?
>
>  - Perhaps adding --date with no date-style specification as another
>    way to trigger "You said 'date' so you must mean you want timed
>    output" heuristics just like existing "--date=<style>" does may
>    let us get away without answering the above two questions,
>    sidestepping the issues?
>
> I dunno.

```

## Junio C Hamano, 2014-10-21 18:06

Subject: Re: git reflog --date
Message-ID: <xmqq8uk91emg.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq8uk91emg.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHQ6N+rb6eNC0_uzCAdH-HNb_SmdG4-W9DgmVKjfNpRcKKxk=w@mail.gmail.com>

```
John Tapsell <johnflux@gmail.com> writes:

> For me, writing "git reflog @{now}"  is a lot less intuitive than "git
> reflog --date"
>
> Currently the top google search for this question is here:
>
> http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
>
> Which doesn't mention "@{now}"   at all.

I would say that a site where cluelesses attempt to lead other
cluelesses is not the best source of information ;-), but that tells
us that either our docs are not read by people or they do not give
necessary information to them clearly enough.

> My opinion:
>
> 1. Add --date   as an option to reflog.  Perhaps using the log.date
> format as the default.
> 2. Document --date in the man page for "git reflog"
> 3. Document @{now}  in the man page for "git reflog"
>
> Sound good?

The order of changes is questionable, but other than that, I think
that would be a good way forward.

```

## John Tapsell, 2014-10-21 18:12

Subject: Re: git reflog --date
Message-ID: <CAHQ6N+qkQbmhY-nueF28+iRhbVvH__gihXb6yyj3dRbgpbV18g@mail.gmail.com>
URL: https://gitlist.dev/e/CAHQ6N%2BqkQbmhY-nueF28%2BiRhbVvH__gihXb6yyj3dRbgpbV18g%40mail.gmail.com
In-Reply-To: <xmqq8uk91emg.fsf@gitster.dls.corp.google.com>

```
Great - now I just need to persuade someone very nice nicely.. :-)

On 21 October 2014 19:06, Junio C Hamano <gitster@pobox.com> wrote:
> John Tapsell <johnflux@gmail.com> writes:
>
>> For me, writing "git reflog @{now}"  is a lot less intuitive than "git
>> reflog --date"
>>
>> Currently the top google search for this question is here:
>>
>> http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
>>
>> Which doesn't mention "@{now}"   at all.
>
> I would say that a site where cluelesses attempt to lead other
> cluelesses is not the best source of information ;-), but that tells
> us that either our docs are not read by people or they do not give
> necessary information to them clearly enough.
>
>> My opinion:
>>
>> 1. Add --date   as an option to reflog.  Perhaps using the log.date
>> format as the default.
>> 2. Document --date in the man page for "git reflog"
>> 3. Document @{now}  in the man page for "git reflog"
>>
>> Sound good?
>
> The order of changes is questionable, but other than that, I think
> that would be a good way forward.

```

## Junio C Hamano, 2014-10-21 22:21

Subject: Re: git reflog --date
Message-ID: <xmqqvbndhxnn.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqvbndhxnn.fsf%40gitster.dls.corp.google.com
In-Reply-To: <xmqq8uk91emg.fsf@gitster.dls.corp.google.com>

```
Junio C Hamano <gitster@pobox.com> writes:

> John Tapsell <johnflux@gmail.com> writes:
>
>> For me, writing "git reflog @{now}"  is a lot less intuitive than "git
>> reflog --date"
>>
>> Currently the top google search for this question is here:
>>
>> http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
>>
>> Which doesn't mention "@{now}"   at all.
>
> I would say that a site where cluelesses attempt to lead other
> cluelesses is not the best source of information ;-), but that tells
> us that either our docs are not read by people or they do not give
> necessary information to them clearly enough.

And it turns out it is a little bit of both.  We have this shown in
"git log --help":

    -g::
    --walk-reflogs::
    ...
    By default, 'commit@\{Nth}' notation is
    used in the output.  When the starting commit is specified as
    'commit@\{now}', output also uses 'commit@\{timestamp}' notation
    instead.

and "git reflog --help" says that "It is an alias for git log -g
--abbrev-commit --pretty=oneline; see git-log(1)." in fairly early
part of its description.

```

## Junio C Hamano, 2014-10-21 23:11

Subject: Re: git reflog --date
Message-ID: <xmqqk33thvbo.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqk33thvbo.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHQ6N+qkQbmhY-nueF28+iRhbVvH__gihXb6yyj3dRbgpbV18g@mail.gmail.com>

```
John Tapsell <johnflux@gmail.com> writes:

> On 21 October 2014 19:06, Junio C Hamano <gitster@pobox.com> wrote:
>> John Tapsell <johnflux@gmail.com> writes:
>>
>>> For me, writing "git reflog @{now}"  is a lot less intuitive than "git
>>> reflog --date"
>>>
>>> Currently the top google search for this question is here:
>>>
>>> http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
>>>
>>> Which doesn't mention "@{now}"   at all.
>>
>> I would say that a site where cluelesses attempt to lead other
>> cluelesses is not the best source of information ;-), but that tells
>> us that either our docs are not read by people or they do not give
>> necessary information to them clearly enough.
>>
>>> My opinion:
>>>
>>> 1. Add --date   as an option to reflog.  Perhaps using the log.date
>>> format as the default.
>>> 2. Document --date in the man page for "git reflog"
>>> 3. Document @{now}  in the man page for "git reflog"
>>>
>>> Sound good?
>>
>> The order of changes is questionable, but other than that, I think
>> that would be a good way forward.
>
> Great - now I just need to persuade someone very nice nicely.. :-)

You should note that #1 is unworkable, as it would make:

    $ git log -g --date default

ambiguous.  Is it asking the timed reflog output using log.date
format on the "default" branch, or is it asking the timed reflog
output using the "default" time format on the HEAD?

You would need to disambiguate by

    $ git log -g --date -- default ;# on default branch
    $ git log -g --date default -- ;# using default time format

or something, which means --date can be the last dashed option on
the command line, and also you close the door for us to ever add
another dashed command line option that takes an optional argument.

So the best you could do is

    1. Add document commit@{timestamp} vs commit@{count} notation
       we have for "git log" also to "git reflog", perhaps?

    2. Document --date=<style> (but not --date alone) as a way to
       trigger timed output for reflog entries, and refer to that
       from "--walk-reflogs" option description as "see also".



 

```

## Phil Hord, 2014-11-04 17:06

Subject: Re: git reflog --date
Message-ID: <CABURp0oHYtnv1hB12XVssjppCkZOpSR2xsZmYR=Etu=sTT0nXg@mail.gmail.com>
URL: https://gitlist.dev/e/CABURp0oHYtnv1hB12XVssjppCkZOpSR2xsZmYR%3DEtu%3DsTT0nXg%40mail.gmail.com
In-Reply-To: <xmqqh9yx1gkt.fsf@gitster.dls.corp.google.com>

```
On Tue, Oct 21, 2014 at 1:24 PM, Junio C Hamano <gitster@pobox.com> wrote:
> John Tapsell <johnflux@gmail.com> writes:
>
>> Hi all,
>>
>>   Could we add a default to "--date" so that:
>>
>> git reflog --date
>>
>> just works?  (Currently you need to do:   git reflog --date=iso)  It
>> should probably obey the default in log.date?
>
> Hmph.  "--date=<style>" is not the way to choose between timed and
> counted output in the first place, though.

Of course not.  I always use --relative-date for this.

```
