git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: referencing a revision at a certain date

From
Jeff King <peff@peff.net>
Date
Feb 11, 2008, 18:29 UTC
Message-ID
<20080211182934.GA23351@sigill.intra.peff.net>
In-Reply-To
<20080211180424.GA4905@clipper.ens.fr>
On Mon, Feb 11, 2008 at 07:04:24PM +0100, David Madore wrote:
Show 7 quoted lines
> I understand that if "rev" denotes a certain revision, then "rev~42"
> references the commit which is 42 generations back from rev.  What I'd
> like to do is write something like "rev~@{2008-01-18}" (say) to get
> the same thing but with the 42 being computed automatically so that
> the commit in question is the latest possible (in commit date) before
> 2008-01-18.  Is this possible?  If so, how?  If not, might I suggest
> this as an addition for consideration?
How about --before=2008-01-18? As in,
  git log --before=2008-01-18

to start your log there (and "git log -1 --before=2008-01-18" if you just want that one commit).

> I thought "rev@{2008-01-18}" did this, but apparently it doesn't: it
> requires a ref log of some kind, and I don't know how to make a ref
> log (git-clone doesn't seem to copy them).

Ref logs are a log of where your particular, local ref was pointing to. In other words, it is a history not of the project commits, but of an individual branch in your local repository. So you don't ask the reflog things like "which commit has a date at X" but rather "where was my master branch pointing at 3pm yesterday?"

And because they are purely a local matter, they don't get copied by clone.

> So, is there some way I can either generate a ref log by
> systematically taking the first parent in each commit as per git-log
> --first-parent, OR (better) specify a revision directly that way?

So this question doesn't really make sense. You generate a ref log by doing operations on a branch.

-Peff
Previous: David MadoreNext: Jakub Narebski
Message 2 of 4 in “referencing a revision at a certain date”
  1. David MadoreFeb 11, 2008
  2. Jeff KingFeb 11, 2008
  3. Jakub NarebskiFeb 11, 2008
  4. David MadoreFeb 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.