{"thread":{"id":"14217","subject":"diff/Checking out by date specification","startedAt":"2008-06-30T02:24:03Z","lastAt":"2008-06-30T05:26:12Z","messageCount":6,"participants":["Toby Corkindale","Jeff King","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81702","messageId":"486843C3.30402@rea-group.com","threadId":"14217","inReplyTo":null,"subject":"diff/Checking out by date specification","fromName":"Toby Corkindale","fromEmail":"toby.corkindale@rea-group.com","sentAt":"2008-06-30T02:24:03Z","receivedAt":"2008-06-30T02:24:03Z","isPatch":false,"sender":{"key":"toby.corkindale@rea-group.com","avatar":null},"body":"Hi,\n`man git-rev-parse` seems to indicate that one can look at the state of \nthe repository by date (absolute or relative), and use this for diff or \ncheckout, etc.\nIt includes examples such as \"{yesterday}\" and \"{1979-02-26 18:30:00}\".\n\nI'm struggling to get this to work in real life with cloned \nrepositories, as I receive an error that the log only goes back  to \nwhenever I cloned the repository.\n\nIs there a way to make this operate upon the remote log?\n\nEg:\n\n$ git clone git://git.kernel.org/pub/scm/git/git.git\n$ cd git\n$ git diff \"@{yesterday}\"\nwarning: Log for '' only goes back to Mon, 30 Jun 2008 12:22:52 +1000.\nfatal: bad object @{yesterday}\n\n\nCheers,\nToby\n\n-- \nToby Corkindale\nSoftware developer\nw: www.rea-group.com\nREA Group refers to realestate.com.au Ltd (ASX:REA)\n\nWarning - This e-mail transmission may contain confidential information.\nIf you have received this transmission in error, please notify us\nimmediately on (61 3) 9897 1121 or by reply email to the sender. You\nmust destroy the e-mail immediately and not use, copy, distribute or\ndisclose the contents.\n"},{"id":"81705","messageId":"20080630032744.GA18930@sigill.intra.peff.net","threadId":"14217","inReplyTo":"486843C3.30402@rea-group.com","subject":"Re: diff/Checking out by date specification","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-30T03:27:45Z","receivedAt":"2008-06-30T03:27:45Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 30, 2008 at 12:24:03PM +1000, Toby Corkindale wrote:\n\n> `man git-rev-parse` seems to indicate that one can look at the state of  \n> the repository by date (absolute or relative), and use this for diff or  \n> checkout, etc.\n> It includes examples such as \"{yesterday}\" and \"{1979-02-26 18:30:00}\".\n\nIt's a little bit more complex than that. The branch@{time} syntax means\n\"what was in _my_ branch at that time\". And if you just cloned, your\nbranch doesn't go back very far.\n\nIf you want to say \"find commits that happened before time T\", you want\n--until or --since (or their aliases --before and --after).\n\nWould the documentation patch below have helped with the confusion?\n\n-- >8 --\ndoc/rev-parse: clarify reflog vs --until for specifying revisions\n\nThe rev-parse manpage introduces the branch@{date} syntax,\nand mentions the reflog specifically. However, new users may\nnot be familiar with the distinction between the reflog and\nthe commit date, so let's help them out with a \"you may be\ninterested in --until\" pointer.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/git-rev-parse.txt |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 9e273bc..59e95ad 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -184,7 +184,10 @@ blobs contained in a commit.\n   second ago\\}' or '\\{1979-02-26 18:30:00\\}') to specify the value\n   of the ref at a prior point in time.  This suffix may only be\n   used immediately following a ref name and the ref must have an\n-  existing log ($GIT_DIR/logs/<ref>).\n+  existing log ($GIT_DIR/logs/<ref>). Note that this looks up the state\n+  of your *local* ref at a given time; e.g., what was in your local\n+  `master` branch last week. If you want to look at commits made during\n+  certain times, see `--since` and `--until`.\n \n * A ref followed by the suffix '@' with an ordinal specification\n   enclosed in a brace pair (e.g. '\\{1\\}', '\\{15\\}') to specify\n-- \n1.5.6.1.202.g3a23.dirty\n"},{"id":"81708","messageId":"48686339.60205@rea-group.com","threadId":"14217","inReplyTo":"20080630032744.GA18930@sigill.intra.peff.net","subject":"Re: diff/Checking out by date specification","fromName":"Toby Corkindale","fromEmail":"toby.corkindale@rea-group.com","sentAt":"2008-06-30T04:38:17Z","receivedAt":"2008-06-30T04:38:17Z","isPatch":false,"sender":{"key":"toby.corkindale@rea-group.com","avatar":null},"body":"Jeff King wrote:\n> On Mon, Jun 30, 2008 at 12:24:03PM +1000, Toby Corkindale wrote:\n> \n>> `man git-rev-parse` seems to indicate that one can look at the state of  \n>> the repository by date (absolute or relative), and use this for diff or  \n>> checkout, etc.\n>> It includes examples such as \"{yesterday}\" and \"{1979-02-26 18:30:00}\".\n> \n> It's a little bit more complex than that. The branch@{time} syntax means\n> \"what was in _my_ branch at that time\". And if you just cloned, your\n> branch doesn't go back very far.\n> \n> If you want to say \"find commits that happened before time T\", you want\n> --until or --since (or their aliases --before and --after).\n> \n> Would the documentation patch below have helped with the confusion?\n\nAh, I see.\nThanks, yes, that would have made the issue clearer.\n\nI think it would be good if you could give a couple of examples, such as:\nHow would I go about checking out the code at the state it was in at, \nsay, 2008-01-01?\nOr how one can get a diff between 2008-01-01 and 2008-01-08?\n\n(I note that \"git-diff --until=2008-01-08 --since=2008-01-01\" fails, as \ndoes \"git-checkout --until=2008-01-08\")\n\nthanks for the quick response!\n-Toby\n\n\n> \n> -- >8 --\n> doc/rev-parse: clarify reflog vs --until for specifying revisions\n> \n> The rev-parse manpage introduces the branch@{date} syntax,\n> and mentions the reflog specifically. However, new users may\n> not be familiar with the distinction between the reflog and\n> the commit date, so let's help them out with a \"you may be\n> interested in --until\" pointer.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  Documentation/git-rev-parse.txt |    5 ++++-\n>  1 files changed, 4 insertions(+), 1 deletions(-)\n> \n> diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\n> index 9e273bc..59e95ad 100644\n> --- a/Documentation/git-rev-parse.txt\n> +++ b/Documentation/git-rev-parse.txt\n> @@ -184,7 +184,10 @@ blobs contained in a commit.\n>    second ago\\}' or '\\{1979-02-26 18:30:00\\}') to specify the value\n>    of the ref at a prior point in time.  This suffix may only be\n>    used immediately following a ref name and the ref must have an\n> -  existing log ($GIT_DIR/logs/<ref>).\n> +  existing log ($GIT_DIR/logs/<ref>). Note that this looks up the state\n> +  of your *local* ref at a given time; e.g., what was in your local\n> +  `master` branch last week. If you want to look at commits made during\n> +  certain times, see `--since` and `--until`.\n>  \n>  * A ref followed by the suffix '@' with an ordinal specification\n>    enclosed in a brace pair (e.g. '\\{1\\}', '\\{15\\}') to specify\n\n\n-- \nToby Corkindale\nSoftware developer\nw: www.rea-group.com\nREA Group refers to realestate.com.au Ltd (ASX:REA)\n\nWarning - This e-mail transmission may contain confidential information.\nIf you have received this transmission in error, please notify us\nimmediately on (61 3) 9897 1121 or by reply email to the sender. You\nmust destroy the e-mail immediately and not use, copy, distribute or\ndisclose the contents.\n"},{"id":"81709","messageId":"alpine.LNX.1.00.0806300042020.19665@iabervon.org","threadId":"14217","inReplyTo":"48686339.60205@rea-group.com","subject":"Re: diff/Checking out by date specification","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-06-30T05:09:04Z","receivedAt":"2008-06-30T05:09:04Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 30 Jun 2008, Toby Corkindale wrote:\n\n> Jeff King wrote:\n> > On Mon, Jun 30, 2008 at 12:24:03PM +1000, Toby Corkindale wrote:\n> > \n> > > `man git-rev-parse` seems to indicate that one can look at the state of\n> > > the repository by date (absolute or relative), and use this for diff or\n> > > checkout, etc.\n> > > It includes examples such as \"{yesterday}\" and \"{1979-02-26 18:30:00}\".\n> > \n> > It's a little bit more complex than that. The branch@{time} syntax means\n> > \"what was in _my_ branch at that time\". And if you just cloned, your\n> > branch doesn't go back very far.\n> > \n> > If you want to say \"find commits that happened before time T\", you want\n> > --until or --since (or their aliases --before and --after).\n> > \n> > Would the documentation patch below have helped with the confusion?\n> \n> Ah, I see.\n> Thanks, yes, that would have made the issue clearer.\n> \n> I think it would be good if you could give a couple of examples, such as:\n> How would I go about checking out the code at the state it was in at, say,\n> 2008-01-01?\n> Or how one can get a diff between 2008-01-01 and 2008-01-08?\n\nThat's not well-defined, except in a particular location. It's pretty \nlikely that there were some changes that were made by different people \nlate in 2007, and languished in their local repositories, and were never \nmerged with each other until after some further changes had been made and \nthe holiday was over. So there isn't a single state of the code as of \n2008-01-01 to compare against.\n\nThe usual case for wanting the diff between 2008-01-01 and 2008-01-08 is \nthat you encountered some version on each of those dates, and you want to \nknow what the difference is between them, and reflogs work for that, but \nit's also possible that what you want is the states that were somewhere \nelse at that point, and I don't think we have a good solution for that \ncurrently unless you can run git commands there to look at the reflog for \nthat location.\n\nBut, in general, with a distributed system like git, you'll do better to \nlook at the history graph around that time with gitk and find the states \nyou're actually interested in by other features or a combination of \nfeatures.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"81710","messageId":"20080630052105.GA21954@sigill.intra.peff.net","threadId":"14217","inReplyTo":"48686339.60205@rea-group.com","subject":"Re: diff/Checking out by date specification","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-30T05:21:05Z","receivedAt":"2008-06-30T05:21:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 30, 2008 at 02:38:17PM +1000, Toby Corkindale wrote:\n\n> I think it would be good if you could give a couple of examples, such as:\n> How would I go about checking out the code at the state it was in at,  \n> say, 2008-01-01?\n> Or how one can get a diff between 2008-01-01 and 2008-01-08?\n>\n> (I note that \"git-diff --until=2008-01-08 --since=2008-01-01\" fails, as  \n> does \"git-checkout --until=2008-01-08\")\n\nThat is a little bit trickier, since there is a not a convenient syntax\nfor selecting a particular revision by commit time. So you _can_ do\nthis:\n\n  git diff \\\n    `git rev-list -1 --until=2008-01-01 HEAD` \\\n    `git rev-list -1 --until=2008-01-08 HEAD`\n\nBut that isn't quite what you want either. Remember that history can\nfollow many branches simultaneously. So what we are saying with\n\"--until\" here is \"show me all the commits that happened before this\ntime\", and then we use \"-1\" to say \"pick the first one.\" So you are\nreally picking two points in time that are close to what you want, and\nthen diffing the two states.\n\nDepending on what you want to do, that may be enough. But more likely,\nyou are interested in the actual shape of history, so looking at the\nindividual commits with something like \"gitk --since=2008-01-01\n--until=2008-01-08\" is probably going to be more instructive.\n\n-Peff\n"},{"id":"81711","messageId":"20080630052612.GA22699@sigill.intra.peff.net","threadId":"14217","inReplyTo":"20080630052105.GA21954@sigill.intra.peff.net","subject":"Re: diff/Checking out by date specification","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-30T05:26:12Z","receivedAt":"2008-06-30T05:26:12Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 30, 2008 at 01:21:05AM -0400, Jeff King wrote:\n\n> Depending on what you want to do, that may be enough. But more likely,\n> you are interested in the actual shape of history, so looking at the\n> individual commits with something like \"gitk --since=2008-01-01\n> --until=2008-01-08\" is probably going to be more instructive.\n\nSide note: what you may have _really_ wanted was \"what is the difference\nbetween what was in Junio's 'master' branch on those dates\". I.e.,\nlooking at the sequence of states at the tip of some \"official\" git\nrepo.\n\nIn that case, you could get the answer you want by looking in Junio's\nreflog. However, that information is not generally available through\ngit. There is no support for downloading reflogs, and most people don't\nhave reflogs enabled on their published bare repos. If Junio enabled\nreflogs on pushing to his bare repo, then you could manually download\nthem into your .git/logs/ hierarchy and pretend that that was your\nhistory of your refs.\n\n-Peff\n"}]}