git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Using kdiff3 to compare two different revisions of a folder

From
Brian Downing <bdowning@lavos.net>
Date
Feb 13, 2008, 17:44 UTC
Message-ID
<20080213174428.GN27535@lavos.net>
In-Reply-To
<b8bf37780802121744i62849a53rfa71cc0571aec3a@mail.gmail.com>
On Tue, Feb 12, 2008 at 11:44:07PM -0200, André Goddard Rosa wrote:
Show 12 quoted lines
>     I would like to use kdiff3 to compare some folder like "include"
> between two different revisions.
>     It would be something like "git diff v2.5:makefile HEAD:makefile",
> but for an entire folder.
> 
>     Kdiff3 give me a quick glance of its nice graphical output of the
> differences, without have to resort to looking/parsing 'git log'
> output.
>     For now, easiest way for me is to keep my tree replicated in two
> different folders pointing to different revisions then use it.
> 
>     Is there a better way to do this kind of comparison?

Maybe you want something like this? This uses kdiff3 to compare two full commits, by extracting the changed files into a temporary location. Modifying it so it can work with path limiters and/or take arguments exactly like 'git diff' is left as an excercise for the reader.

-bcd
#!/bin/sh -e
# usage: git-kdiff3 commit1 commit2

SUBDIRECTORY_OK=1 . git-sh-setup cd_to_toplevel

O=".git-kdiff3-tmp-$$" list="$O/list" trap "rm -rf $O" 0 mkdir $O

git diff --name-only -z $1 $2 > $list

cat $list | xargs -0 git archive --prefix=a/ $1 | tar xf - -C $O cat $list | xargs -0 git archive --prefix=b/ $2 | tar xf - -C $O

kdiff3 $O/a $O/b
Previous: André Goddard RosaNext: André Goddard Rosa
Message 2 of 7 in “Using kdiff3 to compare two different revisions of a folder”
  1. André Goddard RosaFeb 13, 2008
  2. Brian DowningFeb 13, 2008
  3. André Goddard RosaFeb 14, 2008
  4. Robin RosenbergFeb 13, 2008
  5. André Goddard RosaFeb 14, 2008
  6. Jan HudecFeb 17, 2008
  7. André Goddard RosaFeb 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.