8.6.15 Extract differences and merge updates for source files
Following one of these procedures will extract differences between two source
files and create unified diff files file.patch0 or
file.patch1 depending on the file location:
$ diff -u file.old file.new1 > file.patch0
$ diff -u old/file new1/file > file.patch1
The diff file (alternatively called patch file) is used to send a program
update. The receiving party will apply this update to another file
by:
$ patch -p0 file < file.patch0
$ patch -p1 file < file.patch1
If you have three versions of source code, you can merge them more effectively
using diff3
:
$ diff3 -m file.mine file.old file.yours > file