From: Jakub Narebski <jnareb@gmail.com>
To: David Madore <david.madore@ens.fr>
Cc: GIT mailing-list <git@vger.kernel.org>
Subject: Re: referencing a revision at a certain date
Date: Mon, 11 Feb 2008 10:40:39 -0800 (PST) [thread overview]
Message-ID: <m3r6fje3q8.fsf@localhost.localdomain> (raw)
In-Reply-To: <20080211180424.GA4905@clipper.ens.fr>
David Madore <david.madore@ens.fr> writes:
> I'm left quite confused by the git-rev-parse(1) man page, I wonder if
> someone can help me with this.
>
> I understand that if "rev" denotes a certain revision, then "rev~42"
> references the commit which is 42 generations back from rev.
To be more exact it is 42 generations in straight, first-parent
line. rev~3 is shortcut to rev^^^, which is shortcut to rev^1^1^1,
where rev^1 means 1st parent of 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?
There is no direct mapping from date to a commit. So you cannot name a
commit (specify a revision) using date. Besides commit has two dates:
author date (creation date), and commit date (modification date,
roughly).
But you can can get commit closest to given date by combining the time
limiting with limiting number of commits, as described in "Commit
limiting" in git-rev-list(1) and git-log(1) manpages.
$ git log -n 1 --before=<date> <branch>
which would return first commit older than <date>, starting from
<branch>.
> 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).
Reflogs are history (log) of a position of branch tip (ref) in a local
repository. Reflog stores sha-1 of top commit before and after change,
date of change, and description of command that changed it. For
example <branch>@{1} refers to position of branch before you did
something locally to change it, were it commit, amending a commit,
or for example fetching from remote repository.
> 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?
Again: you cannot specify a commit in such way. You can find a (series
of) commits which fulfill given condition.
HTH
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2008-02-11 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 18:04 referencing a revision at a certain date David Madore
2008-02-11 18:29 ` Jeff King
2008-02-11 18:40 ` Jakub Narebski [this message]
2008-02-11 18:57 ` David Madore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3r6fje3q8.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=david.madore@ens.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.