Monday, December 22, 2008

Meld: Open Source diff and merge tool for Linux

When I chose to move over to Linux from Windows on my development computer, I had to find an alternative diff and merge tool as I had been using TortoiseSVN for this functionality. That's when I found about Meld and I have been pleasantly surprised by this simple yet powerful diff tool.

Easy Installation

Since Meld is in the Ubuntu package archives, you can easily install it by opening Applications > Add/Remove. When Add/Remove opens, search for Meld and select to install Meld Diff Viewer. From the command line, you can also install Meld through apt with the following command: sudo apt-get install meld



In Place Editing

The main feature that has blown me away with Meld is the capability to edit files while you are comparing them. Not only can you do normal merge operations with files you are comparing, but you can actually edit the files as though they are in a text editor and Meld does realtime comparisons as you do this. This really comes in handy in all sorts of situations.

You can see in the image that while comparing the two files, I decided to throw in some extra text into file2 and it immediately updated the comparison. Of course if I want to move the change over to file1 all I have to do is click the black arrow and it will update file1. This is a very powerful feature and really saves time when you need to be able to make changes in a hurry to multiple files.

Easy Integration with RapidSVN

If you miss the file comparison feature found in TortoiseSVN under Windows, you can setup Meld to be your file comparison tool under RapidSVN in Linux. In RapidSVN, click on View from the menu bar and select Preferences. Once the Preferences Menu opens, click on the Diff Tool tab, type meld in the command text box and click OK. Now when you choose to diff files from within RapidSVN, it will use Meld to compare files.

Integration with Nautilus

For more siplicity, you can setup Nautilus so that Meld shows up in the right-click menu when you select two or more files. In order to do this, you'll need to install the Nautilus Actions Configuration application. Open up Applications > Add/Remove. When Add/Remove opens search for Nautilus Actions Configuration and install it. Once installed, go to System > Preferences > Nautilus Actions Configuration. Once it loads, click the Add button.
  1. Set the Label to Meld. This is the text that will show up when you right click.

  2. Set the Icon to wherever your Meld icon image file is. Mine is located at /usr/share/pixmaps/meld.png.

  3. Set the path to meld

  4. Set the parameters to %M. If you look at the legend, this will pass in a space-separated list of the selected files/folders with their full paths.

  5. Click the Conditions tab.

  6. Set Filenames to * and check the Match Case check box.

  7. Set Mimetypes to */*

  8. Select the Both radio button and check the Appears if selection has multiple files or folders check box under "Appears if selection contains."

  9. Click OK
Now when you select two files in Nautilus and right click, you will have a menu item called Meld that will allow you to compare the files. Nice...

6 comments:

Anonymous said...

Thanks!

Anonymous said...

Nice! Thanks a lot!

Anonymous said...

very nice. thank you

Anonymous said...

Great !!!
Thanks a lot !

Anonymous said...

I love Meld!

mizar said...

Needless to say, in Ubuntu Unity the nautilus integration is completely broken.

© 2010 Confessions of a Java Programmer, All Rights Reserved