David Madore <david.madore@xxxxxx> 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html