Re: Why do dates in refspecs require the reflog?

4 messages, 4 authors, 2016-06-15 · open the first message on its own page

Re: Why do dates in refspecs require the reflog?

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:23

Michael Haggerty [off-list ref] writes:
There is yet a third similar question: "What is the last commit that is
currently on the master branch that was *authored* at least one year
ago? Please note that this question is even subtler, because author
timestamps are often out-of-order even on a single branch (whereas
commit timestamps are usually in order). I don't know of a simple git
command to answer this question.
--author-date-order?

Re: Why do dates in refspecs require the reflog?

From: Robert Dailey <hidden>
Date: 2016-06-15 23:03:23

On Tue, Dec 30, 2014 at 2:55 PM, Junio C Hamano [off-list ref] wrote:
Michael Haggerty [off-list ref] writes:
quoted
There is yet a third similar question: "What is the last commit that is
currently on the master branch that was *authored* at least one year
ago? Please note that this question is even subtler, because author
timestamps are often out-of-order even on a single branch (whereas
commit timestamps are usually in order). I don't know of a simple git
command to answer this question.
--author-date-order?
Thanks to everyone for explaining this, it makes sense now. I've been
using git a long time and I found this rather unintuitive because my
mindset was not on "reflog" but instead "git log", so there was a huge
misunderstanding.

Is it valid to use durations (as Michael has done) in the --since and
--until options to `git log`? It also feels like there should be a
shorthand for the `git log` usage in conjunction with `git show`... I
could probably make an alias for it. But basically what I'm looking
for is this (please correct me if I'm wrong):

$ git log --since='1 year ago' -1
(somehow grab the SHA1 from the commit printed above)
$ git show <grabbed SHA1>:Path/To/File.h
(path to file is parameterized above)

So basically these two commands together could be stuffed into an alias:

$ git log-show '1 year ago' Path/To/File.h

This is the best I can come up with for now. Note also that "accuracy"
isn't important here, just "closest matching". I appreciate and
understand that things can be out of order (as far as commit
timestamps go, since you can rebase and reorder things). Accuracy for
these things aren't too important because usually I will use them for
bisect or an approximation of where in time I want to see a file for
code reference (i.e. how a function "used to look back then").

Re: Why do dates in refspecs require the reflog?

From: Michael Haggerty <hidden>
Date: 2016-06-15 23:03:23

On 12/30/2014 09:55 PM, Junio C Hamano wrote:
Michael Haggerty [off-list ref] writes:
quoted
There is yet a third similar question: "What is the last commit that is
currently on the master branch that was *authored* at least one year
ago? Please note that this question is even subtler, because author
timestamps are often out-of-order even on a single branch (whereas
commit timestamps are usually in order). I don't know of a simple git
command to answer this question.
--author-date-order?
Does --author-date-order cause --before/--after/--since/--until to use
author dates rather than commit dates? The documentation doesn't mention
that effect. If not, then it doesn't help much.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

Re: Why do dates in refspecs require the reflog?

From: Jeff King <hidden>
Date: 2016-06-15 23:03:23

On Tue, Dec 30, 2014 at 03:39:53PM -0600, Robert Dailey wrote:
It also feels like there should be a
shorthand for the `git log` usage in conjunction with `git show`... I
could probably make an alias for it.
One thing I didn't see mentioned in this thread is that the question
"show me the commit closest to time X" does not have a single answer.
When there are branches, there may be many such answers, one for each
line of simultaneous development.

So people tend not to ask that question[1], and therefore nobody
bothered to make a convenient shorthand for it.

-Peff

[1] What do they ask instead? I find most of my older queries for
    commits are satisfied following parent links from well-known points.
    E.g., finding where topic X was merged, and then walking backwards
    using "^2" to see the tip of the original topic.

    If I am looking for information about a particular file about a year
    ago, I often turn to "-S" or git-blame (actually, "tig blame" in my
    case, which lets you walk backwards interactively).

    But of course the exact query will depend on just what it is you
    want to know. :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help