Meld is considered one of my important instruments for working with code and information information. It’s a graphical diff instrument, so for those who’ve ever used the diff command and struggled to make sense of the output, Meld is right here to assist.
Here is a superb description from the undertaking’s web site:
“Meld is a visible diff and merge instrument focused at builders. Meld helps you evaluate information, directories, and model managed tasks. It supplies two- and three-way comparability of each information and directories, and has help for a lot of common model management methods.
“Meld helps you review code changes and understand patches. It might even help you to figure out what is going on in that merge you keep avoiding.”
You can set up Meld on Debian/Ubuntu methods (together with Raspbian) with:
$ sudo apt set up meld
On Fedora or related, it is:
$ sudo dnf set up meld
Meld is cross-platform—there is a Windows install utilizing the Chocolately package deal supervisor. While it isn’t formally supported on macOS, there are builds available for Mac, and you may set up it on Homebrew with:
$ brew cask set up meld
See Meld’s homepage for additional options.
Meld vs. the diff command
If you will have two related information (maybe one is a modified model of the opposite) and need to see the modifications between them, you may run the diff command to see their variations within the terminal:
This instance exhibits the variations between conway1.py and conway2.py. It’s displaying that I:
- Removed the shebang and second line
- Removed (object) from the category declaration
- Added a docstring to the category
- Swapped the order of alive and neighbours == 2 in a way
Here’s the identical instance utilizing the meld command. You can run the identical comparability from the command line with:
$ meld conway1.py conway2.py
You can simply see modifications and merge modifications between information by clicking the arrows (they work each methods). You may even edit the information dwell (Meld doubles up as a easy textual content editor with dwell comparisons as you sort)—simply you should definitely save earlier than you shut the window.
You may even evaluate and edit three completely different information:
Hopefully, you are utilizing a model management system like Git. If so, your comparability is not between two completely different information however to search out variations between the present working file and the one Git is aware of. Meld understands this, so for those who run meld conway.py, the place conway.py is understood by Git, it’s going to present you any modifications made for the reason that final Git commit:
You can see modifications made within the present model (on the proper) and the repository model (on the left). You can see I deleted a way and added a parameter and a loop for the reason that final commit.
If you run meld ., you may see all of the modifications within the present listing (or the entire repository, for those who’re in its root):
You can see a single file is modified, one other file is unversioned (that means it is new to Git, so I have to git add the file earlier than evaluating it), and plenty of different unmodified information. Various show choices are offered by icons alongside the highest.
You can even evaluate two directories, which is usually useful:
Even common customers can discover comparisons with diff troublesome to decipher. I discover the visualizations Meld supplies make a giant distinction in troubleshooting what’s modified between information. On high of that, Meld comes with some useful consciousness of model management and helps you evaluate throughout Git commits with out considering a lot about it. Give Meld a go, and make troubleshooting just a little simpler on the eyes.
This was initially printed on Ben Nuttall’s Tooling blog and is reused with permission.