git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git reflog --date
@ 2014-10-21  8:11 John Tapsell
  2014-10-21 17:24 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: John Tapsell @ 2014-10-21  8:11 UTC (permalink / raw)
  To: Git List

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21  8:11 John Tapsell
@ 2014-10-21 17:24 ` Junio C Hamano
  2014-10-21 17:31   ` John Tapsell
  2014-11-04 17:06   ` Phil Hord
  0 siblings, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2014-10-21 17:24 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 17:24 ` Junio C Hamano
@ 2014-10-21 17:31   ` John Tapsell
  2014-10-21 18:06     ` Junio C Hamano
  2014-11-04 17:06   ` Phil Hord
  1 sibling, 1 reply; 11+ messages in thread
From: John Tapsell @ 2014-10-21 17:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 17:31   ` John Tapsell
@ 2014-10-21 18:06     ` Junio C Hamano
  2014-10-21 18:12       ` John Tapsell
  2014-10-21 22:21       ` Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2014-10-21 18:06 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 18:06     ` Junio C Hamano
@ 2014-10-21 18:12       ` John Tapsell
  2014-10-21 23:11         ` Junio C Hamano
  2014-10-21 22:21       ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: John Tapsell @ 2014-10-21 18:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 18:06     ` Junio C Hamano
  2014-10-21 18:12       ` John Tapsell
@ 2014-10-21 22:21       ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2014-10-21 22:21 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 18:12       ` John Tapsell
@ 2014-10-21 23:11         ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2014-10-21 23:11 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List

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".



 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2014-10-21 17:24 ` Junio C Hamano
  2014-10-21 17:31   ` John Tapsell
@ 2014-11-04 17:06   ` Phil Hord
  1 sibling, 0 replies; 11+ messages in thread
From: Phil Hord @ 2014-11-04 17:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: John Tapsell, Git List

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* git reflog --date
@ 2020-08-12  0:28 Craig H Maynard
  2020-08-12  9:14 ` Jeff King
  0 siblings, 1 reply; 11+ messages in thread
From: Craig H Maynard @ 2020-08-12  0:28 UTC (permalink / raw)
  To: Junio C Hamano

All,

I'm using git version 2.28.0. I don't see any mention of this 'git reflog' option in the online Git docs:

git reflog --date=iso

Any I missing something? 

Thanks,
Craig

--
Craig H Maynard
Rhode Island, USA
(401) 413-2376


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2020-08-12  0:28 git reflog --date Craig H Maynard
@ 2020-08-12  9:14 ` Jeff King
  2020-08-12 12:34   ` Craig H Maynard
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff King @ 2020-08-12  9:14 UTC (permalink / raw)
  To: Craig H Maynard; +Cc: git

On Tue, Aug 11, 2020 at 08:28:55PM -0400, Craig H Maynard wrote:

> I'm using git version 2.28.0. I don't see any mention of this 'git reflog' option in the online Git docs:
> 
> git reflog --date=iso
> 
> Any I missing something?

The reflog command defaults to "reflog show" if no command is given
(from the "Description" section of "git help reflog"):

  The "show" subcommand (which is also the default, in the absence of
  any subcommands) shows the log of the reference provided in the
  command-line (or HEAD, by default). The reflog covers all recent
  actions, and in addition the HEAD reflog records branch switching. git
  reflog show is an alias for git log -g --abbrev-commit
  --pretty=oneline; see git-log(1) for more information.

And the implication that it takes the same options as git-log is spelled
out explicitly in the Options section:

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

You can find a more detailed description of --date in the git-log
manpage.

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git reflog --date
  2020-08-12  9:14 ` Jeff King
@ 2020-08-12 12:34   ` Craig H Maynard
  0 siblings, 0 replies; 11+ messages in thread
From: Craig H Maynard @ 2020-08-12 12:34 UTC (permalink / raw)
  To: Jeff King; +Cc: git


Thanks for this helpful information. I'll read the docs more carefully from now on. -Craig


> On Aug 12, 2020, at 5:14 AM, Jeff King <peff@peff.net> wrote:
> 
> On Tue, Aug 11, 2020 at 08:28:55PM -0400, Craig H Maynard wrote:
> 
>> I'm using git version 2.28.0. I don't see any mention of this 'git reflog' option in the online Git docs:
>> 
>> git reflog --date=iso
>> 
>> Am I missing something?
> 
> The reflog command defaults to "reflog show" if no command is given
> (from the "Description" section of "git help reflog"):
> 
>  The "show" subcommand (which is also the default, in the absence of
>  any subcommands) shows the log of the reference provided in the
>  command-line (or HEAD, by default). The reflog covers all recent
>  actions, and in addition the HEAD reflog records branch switching. git
>  reflog show is an alias for git log -g --abbrev-commit
>  --pretty=oneline; see git-log(1) for more information.
> 
> And the implication that it takes the same options as git-log is spelled
> out explicitly in the Options section:
> 
>   Options for show
>     git reflog show accepts any of the options accepted by git log.
> 
> You can find a more detailed description of --date in the git-log
> manpage.
> 
> -Peff


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-12 12:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12  0:28 git reflog --date Craig H Maynard
2020-08-12  9:14 ` Jeff King
2020-08-12 12:34   ` Craig H Maynard
  -- strict thread matches above, loose matches on Subject: below --
2014-10-21  8:11 John Tapsell
2014-10-21 17:24 ` Junio C Hamano
2014-10-21 17:31   ` John Tapsell
2014-10-21 18:06     ` Junio C Hamano
2014-10-21 18:12       ` John Tapsell
2014-10-21 23:11         ` Junio C Hamano
2014-10-21 22:21       ` Junio C Hamano
2014-11-04 17:06   ` Phil Hord

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).