Meet Meld, an easier to view diff

Do you find it difficult to recognize changes with diff? This can help you! 😃


Meet Meld, an easier to view diff

Meld is a visual comparison and merger tool for developers. Meld helps you compare files, directories and projects controlled by version.

Installation

Use your distro’s repository, examples:

emerge meld # Gentoo, Funtoo, ...
sudo apt install meld # Debian, Ubuntu, Mint, ...
sudo pacman -S meld # Arch, Manjaro, ...
sudo dnf install meld # Red Hat, CentOS, Fedora, ...

Usage

Basically it is the same concept as diff but the command is meld, example:

meld file1.txt file2.txt

For a more detailed example, I created 2 files Shell Script:

  • cat bye.sh
#!/usr/bin/env bash

function bye(){
  [[ ! -z $1 ]] && t="$1" || t=$(basename ${HOME})
  printf "%s\n" "Bye, ${t^}!"
}

bye $1
  • cat hi.sh
#!/bin/sh

function hi(){
  [[ ! -z $1 ]] && t="$1" || t=$(basename ${HOME})
  printf "%s\n" "Hi, ${t^}!"
}

hi $1

If we use diff bye.sh hi.sh the output looks like this:

1c1
< #!/usr/bin/env bash
---
> #!/bin/sh
3c3
< function bye(){
---
> function hi(){
5c5
<   printf "%s\n" "Bye, ${t^}!"
---
>   printf "%s\n" "Hi, ${t^}!"
8c8
< bye $1
---
> hi $1

A little difficult to visualize, right ?!

Already with meld bye.sh hi.sh

Meld area

There are some program options, for example if we go to: FileFormat as patch …, save only the patch (the changes), see image below:

Meld

One more example: One more example

References


commands meld


Share


YouTube channel

Subscribe


Marcos Oliveira

Marcos Oliveira

Software developer
https://github.com/terroo

Related articles