Discussion:
git reflog --date
John Tapsell
2014-10-21 08:11:50 UTC
Permalink
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:34 UTC
Permalink
Post by John Tapsell
Hi all,
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:42 UTC
Permalink
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
Post by Junio C Hamano
Post by John Tapsell
Hi all,
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.
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.
between timed and counted output is not documented clearly enough
to lead to such a misunderstanding?
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:47 UTC
Permalink
Post by John Tapsell
reflog --date"
http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
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.
Post by John Tapsell
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"
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:04 UTC
Permalink
Great - now I just need to persuade someone very nice nicely.. :-)
Post by Junio C Hamano
Post by John Tapsell
reflog --date"
http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
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.
Post by John Tapsell
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"
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 23:11:39 UTC
Permalink
Post by John Tapsell
Post by Junio C Hamano
Post by John Tapsell
reflog --date"
http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
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.
Post by John Tapsell
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"
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".

Junio C Hamano
2014-10-21 22:21:16 UTC
Permalink
Post by Junio C Hamano
Post by John Tapsell
reflog --date"
http://stackoverflow.com/questions/17369254/is-there-a-way-to-cause-git-reflog-to-show-a-date-alongside-each-entry
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.
Loading...