Re: diff/Checking out by date specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 30, 2008 at 02:38:17PM +1000, Toby Corkindale wrote:

> I think it would be good if you could give a couple of examples, such as:
> How would I go about checking out the code at the state it was in at,  
> say, 2008-01-01?
> Or how one can get a diff between 2008-01-01 and 2008-01-08?
>
> (I note that "git-diff --until=2008-01-08 --since=2008-01-01" fails, as  
> does "git-checkout --until=2008-01-08")

That is a little bit trickier, since there is a not a convenient syntax
for selecting a particular revision by commit time. So you _can_ do
this:

  git diff \
    `git rev-list -1 --until=2008-01-01 HEAD` \
    `git rev-list -1 --until=2008-01-08 HEAD`

But that isn't quite what you want either. Remember that history can
follow many branches simultaneously. So what we are saying with
"--until" here is "show me all the commits that happened before this
time", and then we use "-1" to say "pick the first one." So you are
really picking two points in time that are close to what you want, and
then diffing the two states.

Depending on what you want to do, that may be enough. But more likely,
you are interested in the actual shape of history, so looking at the
individual commits with something like "gitk --since=2008-01-01
--until=2008-01-08" is probably going to be more instructive.

-Peff
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux