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

Side-by-side diff and patch visualization

From
Wincent Colaiuta <win@wincent.com>
Date
Sep 19, 2007, 11:40 UTC
Message-ID
<A92611E8-1035-46A6-AFEF-9C8A6F93AFB1@wincent.com>

Does anybody know of any tools for doing side-by-side visualizations of diffs and patches which work well with Git?

By side-by-side I mean something like what's shown in this screen shot:
<http://wincent.com/images/side-by-side-diff.png>

For simple diffs there is little advantage here over a raw textual diff, but as patch complexity and size increase the side-by-side diff can sometimes prove itself to be more useful:

- totally flexible notion of context (you can scroll as far as you  
want in either direction)
- this flexibility comes with the same rapid movement between changes  
(ie. up/down cursor keys to jump between hunks no matter how far  
apart they are)
- for complex diffs, truly comprehending the nature of the changes  
may be easier in a side-by-side format
- as icing on cake, the implementation in the screenshot highlights  
the removed/added portions within each line

Now, that screenshot is actually of Apple's FileMerge app on Mac OS X and it would be fairly straightforward to write a dump wrapper script that either just interpreted the output of git-diff, or could be used in conjunction with GIT_EXTERNAL_DIFF, to feed files into opendiff two at a time, but that wouldn't allow you to easily visualize diffs which touch many paths.

So, can anyone recommend a tool which can do this kind of side-by- side visualization and plays nicely with Git? Experience with opendiff and git-mergetool has spoilt me here. For most cases I would continue to use vanilla git-diff (or gitk), but when I see a change that I'd like to visualize side-by-side I'd like to be able to use this alternative diff viewer (or can gitk already do side-by-side diffs and I just haven't seen how to turn them on?). Bonus points if I could not only view existing commits, but proposed commits too (ie. the ability to feed in a patch and see a side-by-side visualization of what the diff would look like if applied).

If nothing exists I will look at quickly hacking something together (most likely something that just reads the output of git-diff), but it will be just that, a quick hack.

Cheers, Wincent

Next: Jeff King
Message 1 of 5 in “Side-by-side diff and patch visualization”
  1. Wincent ColaiutaSep 19, 2007
  2. Jeff KingSep 19, 2007
  3. Wincent ColaiutaSep 19, 2007
  4. Andy ParkinsSep 19, 2007
  5. David KastrupSep 19, 2007

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.