Meld is a visual comparison and merger tool for developers. Meld helps you compare files, directories and projects controlled by version.
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, ...
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
There are some program options, for example if we go to: File → Format as patch …, save only the patch (the changes), see image below:
One more example: