vimdiff - edit two, three or four versions of a file with Vim and show differences
$ cat a.txt this is line 1 this is line 2 this is line 3 this is line 4
$ cat b.txt this is line 1 this is line 2 this is line 3 this is line 5 this is line 6
$ vimdiff a.txt b.txt
To split the screen horizontally $ vimdiff -o a.txt b.txt
To apply changes from the left file to the right file :diffput
To apply changes from the right file to the left file :diffget
To undo changes :diffupdate
To exit the diff window :qa to exit all the files without saving. :q to exit the files one by one without saving. :wq! to save and exit files one by one.
regards, T.Dhanasekar