However I find it very difficult to read the output from the diff command. At the terminal, the VIM editor will syntax highlight opened diff files which helps, or even a simple script can be used for this. However I find side by side comparison of files much easier to interpret, and given the current trend towards wider screens, this is quite practical. Note that to ease side by side comparison of files, it's another good reason to restrict the line lengths in your files, preferably to less than 80 characters.
Mozilla Thunderbird - Colored Diffs addonThe "Colored Diffs" addon is available for the email client I use, Thunderbird. I get a lot of email containing patches either directly from SCM systems, or from mailing lists of open source projects, so this addon helps me parse these quickly. There are useful options like highlighting whitespace so one can see whitespace damage that email clients are prone to do. By hovering over the screenshot below one can see the standard Thunderbird display without the addon.
TkdiffTkdiff is actually part of the TkCVS project, and was the graphical diff tool I used mostly for the last 7 years. It has separate utilities for merging (tkmerge) and managing repositories (tkcvs), and is very functional, with interline diffs etc. However it has some problems mainly due to the poorly maintained tools it's built on, i.e. Tcl/Tk. The main problem I noticed was the very slow cold cache startup because the disk went into a seek storm. I analysed this a bit using strace, and it's because Tcl essentially does find /usr/lib/ /usr/share/ -maxdepth 2 -type f -name pkgIndex.tcl looking for packages to load, on each startup. Coincidentally I notice that Tcl/Tk 8.5 has just been released after 5 years of development. There is mention of fixing this performance issue with new support for modules as opposed to the traditional packages, but tkcvs would have to be modified to take advantage of this. Also even in Tcl/Tk 8.5 there still have been no hooks created for GTK or QT, so applications still look clunky and out of place on linux as you can see below. Note the windows and Mac ports of Tk are well integrated into the GUI in this new version of Tcl/Tk, which is surprising. [Update Aug 2008: There have now been hooks created for GTK+ and QT].
MeldDue to the problems mentioned with Tkdiff above, I've recently switched to using Meld. It provides all the functions that TkCVS does, but in separate tabs instead of separate utilities. It uses the well maintained and elegant PyGtk toolkit, which I've used myself for applications, and so integrates well into the linux desktop at least. If you hover over the screenshot below you can switch between its repository and file comparison views, and with my version (1.1.5), there are plugins provided for the svn, cvs, bzr, mercurial, monotone and tla SCM systems. One very handy thing I noticed that Meld supports is in-place editing of the files being compared, and also very easy merging by clicking on the icons in the center bar. The most common way I use Meld is to review my local changes before committing them to the perforce and subversion SCM systems I use, and to support this I have a handy script. Note if one prefers the KDE environment rather than Gnome/GTK+ then the analogous KDiff3 utility may be more suited.
Google Code - changeset viewerRecently Jenan Wise from google added a changeset viewer to their project hosting web interface. Coincidentally the "Colored Diffs" project mentioned above is hosted on Google Code, so you can view its latest changes as an example. The screenshot below shows the representation of a particular change, where a summary of the diff is shown, and one can drill down further to get a full side by side file comparison of the change.
Github - changeset viewerGithub has a useful interface for (re)viewing changes to a file or more generally change sets to a project. First I'll describe how I setup local forks for a project by explaining how I work with the github coreutils mirror.
This was forked to my a/c on github and then in the my standard coreutils local repo I did:
$ git remote add github email@example.com:pixelb/coreutils.git $ git fetch githubThat worked immediately since there were no new commits. I have repos and branches set like this in .git/config, which allows me to update my github-master branch periodically.
[remote "github"] url = firstname.lastname@example.org:pixelb/coreutils.git fetch = +refs/heads/*:refs/remotes/github/* [branch "selinux-restorecon"] remote = github merge = refs/heads/selinux-restorecon [branch "github-master"] remote = github merge = refs/heads/masterNow I can (force) push my branches to my github fork like:
$ git push github +selinux-restoreconI also removed all but the master branch and my own branches from my github fork, to make it obvious which branches were the ones I wanted to make available.
With these patches now available in github we can leverage some functional and interface advantages of github for working collaboratively on change sets. github has a very nice viewer for topic branches, which you can (re)view each change. See for example:
That shows each commit specific to the branch, and one can add comments there. Also very useful is to see the combined changes on a per file basis, using:
Since Sep 2014 the github diff viewer supports side by side mode, which it calls split diffs, and improved changed word highlighting which you can see at the above link.BTW if you want to reference that raw patch set for piping to git am without having to worry about setting up git remotes etc., just tack a ".patch" on the end of the changeset link like: