meld: graphical tool to diff and merge files
May 2nd, 2007 edited by TinchoEntry submitted by Bart van Kuik. DPOTD needs your help, please contribute!
Every now and then we need to see the differences between two files. You forgot exactly what you changed in that Perl script, or you’d like to check what changes the intern made in Apache’s configuration, et cetera.
For seeing changes between two files, diff
used to be your friend for the command line. Although hard core hackers may disagree, diff its output takes quite a bit of exercise to parse with the human eye. And although diff has a side-by-side mode, a text terminal only offers so much freedom.
A graphical display offers much more possibilities and Meld tries to use them in an admirable fashion. It’s a utility that lets you graphically see the differences between two or three files. And unlike diff, Meld lets you edit (or merge) the files straight away. With the click of a mouse you can copy or move differences between files.
meld httpd.conf httpd.conf.default
Pressing and holding the Shift key will change the arrows to crosses, which lets you swiftly delete the additions that the intern made. (After sternly speaking to the lad!).
If you’re a programmer, you probably store your files in a version control repository like Subversion or CVS. Meld supports this, too. On the command line, type:
meld my/project/directory
Meld recognises a directory that’s under version control and will display any changed files. Double-clicking the file will show the differences between the current file that you’ve been working on, and the file in the repository. Meld is tab-based, so the changes will appear in a separate tab, making it easy to quickly return to the directory overview.
Although it’s not documented, meld seems to supports bzr, CVS, darcs, mercurial, monotone and subversion. Meld packs more features not discussed here, like a mode which displays the differences between directories, multiple languages et cetera. I encourage you to just install the package and look around.
Alternate tools
In the project’s homepage, one can find a little comparison with other similar tools:
- Kdiff3
- Very good for large merges. Automatic merge facility.
- Xxdiff
- Has some nice features such as CVS unmerge and good scriptability. Does 2 and 3 way file comparison but only 2 way directory comparison.
- TkDiff
- Two way file only diff viewer. Depends only on tk.
- GtkDiff
- Gtk1.x diff tool. Project seems dead.
Meld has been available in Debian since Sarge and in Ubuntu since Warty. It depends on the Python scripting language.
May 2nd, 2007 at 5:21 am
Alternative tools: What about vimdiff??? :)
May 2nd, 2007 at 7:59 am
Alternative tool: ediff (Emacs diff tool).
May 2nd, 2007 at 8:24 am
Hi,
meld seems to be GTK-based. Those looking for a Qt-based software should try Kompare, which is an excellent piece of software (I never used meld, so I can’t compare)
May 2nd, 2007 at 8:37 am
Yes, it uses GTK; but more than that, it needs Gnome!
May 2nd, 2007 at 9:49 am
I usually use vimdiff on svn, will probably try out meld on svn later, thanks.
May 2nd, 2007 at 11:49 am
Kompare (http://www.caffeinated.me.uk/kompare/) is the most well known KDE diff frontend
May 2nd, 2007 at 7:47 pm
Great, I’ve been looking for an alternative to KDiff3 for some time, and meld looks promising ;O)
May 3rd, 2007 at 1:39 pm
On my system (sans GNOME and KDE) it required something like 75Mb of dependencies - and that’s the compressed size! Too bad - it looks good.
June 3rd, 2007 at 2:56 pm
Actually the subversion front-end feature is very good. I’ve tried all free software svn front-ends for Linux, and meld is clearly the best one for me. Only the lack of keyboard shortcuts is a minus.
October 15th, 2007 at 7:09 pm
Almost perfect under Ubuntu (7.10), it doesn’t come with gnome-vfs support yet.
April 17th, 2008 at 4:11 pm
Meld is good, but I am looking a diff tool that works also when blocks are shuffled this mean a diff that support crossed correspondencies …
Am I clear enough ?
Ie :
cat ordered.txt
This
is part 1
and 2d part
before
the 3rd
one
cat shuffled.txt
This
is part 1
before
the 3rd
one
and 2d part
same files different line/block order
Well I bet this can be scripted
Regard
–
http://rzr.online.fr/q/diff