Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Debian GNU/Linux Reference Guide
Prev Home Next

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

Debian GNU/Linux Reference Guide
Prev Home Next

  Published under the terms of the GNU General Public License Design by Interspire