From: Matt Graham <mdg149@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: david@lang.hm, git@vger.kernel.org
Subject: Re: how to diff versions of a file
Date: Tue, 3 Feb 2009 08:48:46 -0500 [thread overview]
Message-ID: <1c5969370902030548g284e8ae2i7dc3a866c4337a5f@mail.gmail.com> (raw)
In-Reply-To: <7vk588do5q.fsf@gitster.siamese.dyndns.org>
On Tue, Feb 3, 2009 at 01:34, Junio C Hamano <gitster@pobox.com> wrote:
> david@lang.hm writes:
>
>> I don't think it's trivial
>
> I think you meant to say it _is_ trivial.
>
>> If you just wanted three commits ago you could do
>>
>> git diff HEAD..HEAD^^^ tree.c
>
> That would give you a reverse diff; I think you probably meant the other
> way around, "git diff HEAD~3 HEAD tree.c".
>
>> but three changes to tree.c ago I think you need to do multiple
>> iterations of git blame to find out what commit was three edits ago.
>
> git diff $(git rev-list -3 HEAD -- tree.c | sed -n -e '$p') HEAD -- tree.c
>
> This assumes that the history is linear but your statement "three edits
> ago" already assumes that, so...
Thanks Junio, this is exactly what I was asking for.
And thanks for the tip about it depending on the history being linear.
next prev parent reply other threads:[~2009-02-03 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 5:00 how to diff versions of a file Matt Graham
2009-02-03 6:08 ` david
2009-02-03 6:34 ` Junio C Hamano
2009-02-03 13:48 ` Matt Graham [this message]
2009-02-03 7:34 ` Jeff King
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=1c5969370902030548g284e8ae2i7dc3a866c4337a5f@mail.gmail.com \
--to=mdg149@gmail.com \
--cc=david@lang.hm \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).