35

I'm a big fan of meld - a visual diff and merge tool for Gnome. It shows two files (or directories) side-by-side and with their differences highlighted, and I can easily select which parts I want to move from one file to the other.

I'm looking for a similar tool, but it should work on the (Linux) console, eg. it should not require any X server. Maybe using an ncurses interface.

Is there such tool?

4 Answers4

19

Ah just found out about vimdiff. It pretty much does what I was looking for. here's a quick guide

9

sdiff, a classic command line tool which shows text file differences side by side, also has an interactive merge mode. Use it by running

$ sdiff -o output.txt input1.txt input2.txt

It is the default interactive command line merge tool used by Gentoo Linux' etc-update utility.

Advantages over vimdiff are ubiquitous availability and much simpler handling.

fbmd
  • 190
9

You can use vim -d file1 file2 for that.

raphink
  • 3,871
8

I use the Midnight Commander for this. Select a file on the left pane and another on the right, press F9, then Command > Compare Files.

It can also be called using the mcdiff command

Use Enter to navigate to the next diff, F5 to merge the selected diff from the right to the left and F15 (or Shift + F5) from left to right.

It is possible to change the keybindings (useful on Mac):

On mc.keymap file section [diffviewer] change from:

MergeOther = f15

To:

MergeOther = f6

If you want F6 to be the default key for this, ask here

More info on F1

Bernardo Ramos
  • 181
  • 1
  • 3